正确的方式调用“删除”链接?
使用jquery,当我单击"Remove“链接时,如何调用该函数?
在引导模态内
我的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();
}
});
});发布于 2018-11-22 07:17:51
这可能对你有帮助
$(document).on('click', '#taglist li a.remove',function(){
alert('hi');
//Your logic here....
});检查这个小提琴
https://stackoverflow.com/questions/53425239
复制相似问题