1
             $(document).ready(function(){
                $(".item_delete").easyconfirm({locale: {
                        title: 'Select Yes or No', 
                        text: 'Do you really want to delete this product?',
                        button: ['No','Yes']
                }});
                $(".item_delete").click(function(){
                    $(location).attr('href',$(this).attr("href"));
                });
            });

上記のコードは実行したいコードですが、複数のリンクでは機能しません。おそらく、コードがどの HREF を選択するかを判断できないためです。

            <a href="<?php echo "index.php?module=account&del_product=".$row['product_code']; ?>" class="item_delete ui-icon ui-icon-trash"></a>

リンクに以下のような複数の href がある場合、jquery はクリックした特定のリンクをどのように検出しますか?

             <a href="index.php?module=account&del_product=1"></a>
             <a href="index.php?module=account&del_product=2"></a>
             <a href="index.php?module=account&del_product=3"></a>
             <a href="index.php?module=account&del_product=4"></a>
             <a href="index.php?module=account&del_product=5"></a>
             <a href="index.php?module=account&del_product=6"></a>

ご協力ありがとうございました...

ちなみに、jQuery用のこの「Easy Confirm Dialog」プラグインを使用しています - http://projectshadowlight.org/jquery-easy-confirm-dialog/

4

1 に答える 1

3

$(this) を使用すると、現在クリックされているハイパーリンクの href を取得できます

    $("a.item_delete").on("click", function(){
        console.log($(this).attr("href"));
    });
于 2012-04-05T02:28:08.117 に答える