Jquery Change() 函数不起作用
我有两张桌子,我想在一张桌子上发生更改事件。 也就是说,当我单击第一个表时,我想对第二个表进行一些更改。但不知何故,下面的更改功能不起作用。有什么建议吗?
$("#history_table table:eq(0)").click(function(){
$("#history_table table:eq(1) thead tr th:nth-child(1)").html("New");
});
$("#history_table table:eq(1) thead tr th:nth-child(1)").change(function() {
alert('Handler for .change() called.');
});
这里history_table是一个div标签id,它有两个表。 click() 函数正在工作,但我也希望看到警报消息,但这没有显示。
I have two tables and I want to have change event on one table.
That is when I click on first table, I want to have some changes to the second table. But somehow below change function is not working. Any suggestions?
$("#history_table table:eq(0)").click(function(){
$("#history_table table:eq(1) thead tr th:nth-child(1)").html("New");
});
$("#history_table table:eq(1) thead tr th:nth-child(1)").change(function() {
alert('Handler for .change() called.');
});
Here history_table is a div tag id and it has two tables. click() function is working but I am expecting to see alert message as well, but this is not showing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
.change()
事件/处理程序不适用于(或已触发默认情况下),它用于更改数据的输入样式元素,例如或
The
.change()
event/handler isn't for (or fired by default for) this, it's for an input style element changing data, for example a<input>
or a<select>
. Instead, you'll want a custom event (or manually firingchange
...) here, for example: