【问题标题】:Proper way of calling this LINK调用此链接的正确方法
【发布时间】:2019-04-24 19:12:07
【问题描述】:

PICTURE of Remove link

调用“删除”链接的正确方法?

使用 jquery,当我单击“删除”链接时,我怎样才能调用该函数?

在引导模式中

我的 HTML:

<table>
    <tr>
    <td valign="">
        <div id="imgtag"> 
            <center><div id="uploads3"><?php echo $eq_picPa; ?></div></center>
            <div id="tagbox">
            </div>
        </div>
    </td>
    <td valign="top">
        <div id="taglist"> 
            <span class="tagtitle">List of Tags</span> 
            <ol>
                <li rel="1"><a>jelly</a> (<a class="remove">Remove</a>)</li> 
            </ol> 
        </div> 
    </td>
    </tr>
</table>

我的 JS:

    $('#taglist').on('click', 'li a.remove',function(){
    alert('hi');
      id = $(this).parent().attr("rel");
      type = "remove";
      // get all tag on page load
      $.ajax({
        type: "POST", 
        url: "savetag.php", 
        data: {"id": id, "type": type},
        success: function(data){
          viewtag();
        }
      });
    });

【问题讨论】:

  • 请有人帮帮我!
  • 您得到的响应/错误是什么?
  • 什么都没有。没有触发
  • 我的点击功能对吗?
  • 你试过我的答案了吗?

标签: jquery ajax hyperlink


【解决方案1】:

这可能对你有帮助

$(document).on('click', '#taglist li a.remove',function(){
    alert('hi');
    //Your logic here....
});

检查这个fiddle

【讨论】:

  • 是的,它就像一个魅力 :) 抱歉回复晚了
  • 继续摇摆:-)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-30
  • 1970-01-01
  • 2021-08-30
相关资源
最近更新 更多