02.06.2015 Views

Bootstrap Tutorial

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER<br />

41<br />

<strong>Bootstrap</strong> Alert Plugin<br />

Alert messages are mostly used to display information such as warning or confirmation messages to the<br />

end users. Using alert message plugin you can add dismiss functionality to all alert messages.<br />

If you want to include this plugin functionality individually, then you will need alert.js. Else, as mentioned in the<br />

chapter <strong>Bootstrap</strong> Plugins Overview, you can include bootstrap.js or the minified bootstrap.min.js.<br />

Usage<br />

You can enable dismissal of an alert in the following two ways:<br />

<br />

Via data attributes: To dismiss via Data API just add data-dismiss="alert" to your close button to<br />

automatically give an alert close functionality.<br />

<br />

&times;<br />

<br />

<br />

Via JavaScript: To dismiss via JavaScript use the following syntax:<br />

$(".alert").alert()<br />

EXAMPLE<br />

The following example demonstrates the use of alert plugin via data attributes.<br />

<br />

<br />

&times;<br />

<br />

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

network connection.<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!