Source

Alerts a awm bawk

User thiltih dan tlangpui atan contextual feedback message pe la, alert message awm thei leh inthlak danglam thei tlemte nen pe rawh.

Entirna te

Text sei zawng zawng tan alerts a awm a, chubakah optional dismiss button pawh a awm bawk. Styling dik tak atan chuan contextual class mamawh pariat zinga pakhat hmang la (eg, .alert-success). Inline dismissal atan chuan alerts jQuery plugin hmang la .

<div class="alert alert-primary" role="alert">
  A simple primary alert—check it out!
</div>
<div class="alert alert-secondary" role="alert">
  A simple secondary alert—check it out!
</div>
<div class="alert alert-success" role="alert">
  A simple success alert—check it out!
</div>
<div class="alert alert-danger" role="alert">
  A simple danger alert—check it out!
</div>
<div class="alert alert-warning" role="alert">
  A simple warning alert—check it out!
</div>
<div class="alert alert-info" role="alert">
  A simple info alert—check it out!
</div>
<div class="alert alert-light" role="alert">
  A simple light alert—check it out!
</div>
<div class="alert alert-dark" role="alert">
  A simple dark alert—check it out!
</div>
Assistive technology-te hnena awmzia thlentu

awmzia belhchhah nan color hman hian hmuh theiha hriattirna chauh a pe a, chu chu assistive technology hmangtute hnenah a thlen dawn lo – screen reader ang chi te. Color hmanga tarlan information chu a thupui a\ang ngeia lang (entir nan, hmuh theih thuziak), a nih loh leh kawng dang hmanga telh a nih theih nan enfiah rawh, chu chu .sr-onlyclass nena thup belh thuziak ang chi a ni.

.alert-linkAlert eng pawh chhungah rang takin matching colored links pe turin utility class hmang ang che .

<div class="alert alert-primary" role="alert">
  A simple primary alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-secondary" role="alert">
  A simple secondary alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-success" role="alert">
  A simple success alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-danger" role="alert">
  A simple danger alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-warning" role="alert">
  A simple warning alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-info" role="alert">
  A simple info alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-light" role="alert">
  A simple light alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>
<div class="alert alert-dark" role="alert">
  A simple dark alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
</div>

Thu belhchian dawl lo

Alert-ah hian HTML element dang heading, paragraph leh divider te pawh a awm thei bawk.

<div class="alert alert-success" role="alert">
  <h4 class="alert-heading">Well done!</h4>
  <p>Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.</p>
  <hr>
  <p class="mb-0">Whenever you need to, be sure to use margin utilities to keep things nice and tidy.</p>
</div>

Dismis a ni

Alert JavaScript plugin hmang hian inline-a alert eng pawh dismiss theih a ni. Hetah hian engtin nge ni ang:

  • Alert plugin kha i load tawh ngei ang che, a nih loh leh Bootstrap JavaScript compile kha i load tawh ngei ang.
  • Kan JavaScript hi source atanga i siam a nih chuanutil.js . Compiled version ah hian hei hi a tel a ni.
  • Dismiss button leh .alert-dismissibleclass te dah la, chu chuan alert dinglamah extra padding a dah belh a, .closebutton chu a dah bawk.
  • Dismiss button ah chuan data-dismiss="alert"attribute chu add la, chu chuan JavaScript functionality a tichhuak ang. <button>Device zawng zawnga nungchang dik tak neih theih nan element nen hmang ngei ang che .
  • Dismissing hunah alerts animate tur chuan .fadeand .showclass te kha add ngei ang che.

Hei hi live demo hmangin action-ah i hmu thei ang:

<div class="alert alert-warning alert-dismissible fade show" role="alert">
  <strong>Holy guacamole!</strong> You should check in on some of those fields below.
  <button type="button" class="close" data-dismiss="alert" aria-label="Close">
    <span aria-hidden="true">&times;</span>
  </button>
</div>

JavaScript tih dan tur

Triggers te a awm

JavaScript hmanga alert dismissal theihna tur:

$('.alert').alert()

A nih loh leh alert chhungadata button pakhata attribute awmte nen , a chunga kan hmuh ang khan:

<button type="button" class="close" data-dismiss="alert" aria-label="Close">
  <span aria-hidden="true">&times;</span>
</button>

Alert khar chuan DOM atangin a paih chhuak ang tih hre reng ang che.

Thiltih dan tur

Tihdan Hrilhfiahna
$().alert() data-dismiss="alert"Attribute nei descendant element-a click event awmte chu alert ngaihthlak turin a siam . (Data-api-a auto-initialization hman hunah a ngai lo.)
$().alert('close') DOM atanga alert lakchhuah hmangin a khar thin. Element -ah hian .fadeand .showclass a awm chuan alert chu a paih hmain a fade out ang.
$().alert('dispose') Element pakhat alert a tichhia.
$(".alert").alert('close')

Thil thlengte

Bootstrap-a alert plugin hian alert functionality-a hook theihna tur thil thleng tlemte a pholang a ni.

Hunbik Hrilhfiahna
close.bs.alert closeHe event hi instance method kan koh chuan a fire nghal vek a ni.
closed.bs.alert He event hi alert khar a nih hunah fire a ni (CSS transition zawh hun a nghak ang).
$('#myAlert').on('closed.bs.alert', function () {
  // do something…
})