html5 - Jquery event on close class button in alert of Bootstrap -
i want perform jquery event on clicking close sign on alert block of jquery. view code 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 below::
$('button.close').click(function () { var id = $(this).attr('data-id'); alert("deleted list is"+id); });
as per above code not able detect or jquery events on clicking 'x' button.
if you're using bootstrap 3, need this:
$('#my-alert').on('close.bs.alert', function () { //code });