我有几个div
,它们的类相同,需要间隔一定的时间才能隐藏,除了一个。我确定了一个具有id
属性的人:
<div id="reload-server-status-message" class="alert alert-warning" style="display: none">
<strong>Please wait! It may take up to 2 minutes!</strong>
</div>
<div class="alert alert-warning" style="display: none">
<strong>I am dif 2. there are yet three more divs, but I am not gonna show them</strong>
</div>
脚本:
$(document).ready(function(){
setTimeout(function(){
$(".alert:not(#reload-server-status)").remove();
}, 5000);
$('#reload-server-status').bind('click',function(e){
e.preventDefault();
$("#reload-server-status-message").show();
document.location.href="<%= admin_server_managements_obtain_statuses_path %>";
});
})