[英]Alertify for OnClick Event of Button
I'm trying to display a message that the user has clicked Delete button when he/she clicks on it. 我正在尝试显示一条消息,用户单击时单击了“删除”按钮。 This is what I'm doing:
这就是我在做什么:
<script>
$('#button_del').on('click',function(e){
alertify.error('You have clicked on Delete!');
});
</script>
But no message appears when I click on the button. 但是,当我单击按钮时,没有消息出现。 What am I doing wrong?
我究竟做错了什么?
There are only four possibilities here: 这里只有四种可能性:
button_del
ID, or there are markup errors involving it. button_del
ID的元素,或者涉及它的标记错误。 #button_del
. #button_del
没有单击#button_del
。 4. the most likely one : 4.最有可能的一个 :
You need to attach the click handler when the document is loaded, otherwise #button_del
is probably not available/loaded yet! 加载文档时,您需要附加单击处理程序,否则
#button_del
可能尚不可用/已加载!
$(document).ready(function() {
$('#button_del').on('click',function(e){
alertify.error('You have clicked on Delete!');
});
});
Even if the first three conditions are met, you'd still have to change this. 即使满足前三个条件,您仍然必须更改此设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.