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
. 4. the most likely one :
You need to attach the click handler when the document is loaded, otherwise #button_del
is probably not available/loaded yet!
$(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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.