02.06.2015 Views

Bootstrap Tutorial

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

&times;<br />

Warning! There was a problem with your<br />

network connection.<br />

<br />

<br />

$(function(){<br />

$(".close").click(function(){<br />

$("#myAlert").alert('close');<br />

});<br />

});<br />

<br />

Try this code using the Try it editor. You can see that the close functionality is applied to all the alert messages i.e<br />

close any alert message, rest of the alert messages also get closed.<br />

EVENTS<br />

Following table lists the events to work with alert plugin. This event may be used to hook into the alert function.<br />

Event Description Example<br />

close.bs.alert<br />

This event fires immediately when<br />

the close instance method is called.<br />

$('#myalert').bind('close.bs.alert',<br />

function () {<br />

// do something…<br />

})<br />

closed.bs.alert<br />

This event is fired when the alert has<br />

been closed (will wait for CSS<br />

transitions to complete).<br />

$('#myalert').bind('closed.bs.alert',<br />

function () {<br />

// do something…<br />

})<br />

EXAMPLE<br />

The following example demonstrates the alert plugin events:<br />

<br />

&times;<br />

Success! the result is successful.<br />

<br />

<br />

$(function(){<br />

$("#myAlert").bind('closed.bs.alert', function () {<br />

alert("Alert message box is closed.");<br />

});<br />

});<br />

<br />

TUTORIALS POINT<br />

Simply Easy Learning

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!