我使用Jquery Confirm 3.3.4,并且我想将$ .fn.confirm方式用作descriped here。
<p>
<a class="example2-1-1 btn btn-primary"
data-title="Goto twitter?"
href="http://twitter.com/craftpip">Goto twitter
</a>
</p>
<script>
$('.example2-1-1').confirm({
content: "This will take you to my twitter <br> You can access the clicked element by <code>this.$target</code>",
});
</script>
但是我想在a属性中添加一些内容,以将其提供给确认对话框。例如
<a class="example2-1-1" href="http://twitter.com/craftpip" myContent="some new content">Goto twitter</a>
有办法吗?
<a class="example2-1-1" href="http://twitter.com/craftpip" data-Content="Wollen Sie wirklich zu Twitter?">Goto twitter</a>
$('.example2-1-1').confirm({
content: $(this).data( "Content" ),
width :'auto'
});