jQuery确认3.3.4:要通过链接循环访问内容

问题描述 投票:0回答:1

我使用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>

有办法吗?

javascript jquery dialog confirm
1个回答
0
投票
<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'
});
© www.soinside.com 2019 - 2024. All rights reserved.