在页面:http://getbootstrap.com/2.3.2/javascript.html#alerts如何使用引导警报事件密切
我们能够看到这样的代码:
$('#my-alert').bind('closed', function() {
// do something…
})
但什么是#my-alert
?
在页面:http://getbootstrap.com/2.3.2/javascript.html#alerts如何使用引导警报事件密切
我们能够看到这样的代码:
$('#my-alert').bind('closed', function() {
// do something…
})
但什么是#my-alert
?
#my-alert
是一个CSS ID选择器,用于标识要绑定到某个函数的元素(my-alert
仅仅是一个示例,插入元素的ID)。
下面是一个例子警报DIV ID为alert1
:
<div class="alert alert-block alert-error fade in" id="alert1">
<p>Alert!</p>
</div>
还有许多其他的方式来选择一个元素。我将在CSS selectors
对于引导3.0读了你可以使用:
$('#my-alert').bind('closed.bs.alert', function() {
// do something…
})
#my-alert
是您的警报DIV