jQuery的按钮单击事件不触发 [英] Jquery button click event not firing
本文介绍了jQuery的按钮单击事件不触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
似乎是一个简单的问题,但解决的另一个问题似乎没有从我的工作。
seems like a simple issue but the solutions to the other problem don't seem to work from me.
试图触发一个按钮点击一个Ajax请求,但它似乎并没有被解雇。
Trying to trigger a AJAX request from a button click but it doesn't seem to be firing.
例如HTML
<button class="remove_weight_button" id="15">x</button>
的javascript
javascript
$(".remove_weight_button").click(function(){
var button_id = $(this).attr("id");
$.ajax({
type: "POST",
url: "weight_tracker_process.php",
data: {
weight_id: button_id,
action: "remove"
},
success: function(){
getWeightData();
},
error: function(){
alert("data removal error");
}
});
return false;
});
推荐答案
在code你能正常工作在拨弄。是您的按钮被通过AJAX后的初始页面加载动态呈现?
解决方案
使用
Use
而不是
$(".remove_weight_button").click(function(){
这篇关于jQuery的按钮单击事件不触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文