Jquery event on close class button in alert of Bootstrap
html, jquery, twitter-bootstrap
Solution
If you're using Bootstrap 3, you need to do this:
$('#my-alert').on('close.bs.alert', function () {
//code
});
Problem
I want to perform some Jquery Event on clicking the Close sign on the alert Block of Jquery. My VIew code is as below:: ``` <div class=' alert alert-block fade in' > <button type='button' class='close' data-dismiss='alert'>×</button> <p>Just Close Me </p> <div> ``` My Js code is as below:: ``` $('button.close').click(function () { var id = $(this).attr('data-id'); alert("deleted list is"+id); }); ``` As per the above code I am not able to detect or do Jquery events on clicking that 'X' button.