2014-04-04 120 views
0

根據控制檯,一切正常,因此我唯一的問題是,控制檯指示的html設置正確,只顯示在第一次之後。(「點擊「)事件,所有後續的將正確地啓動並設置html,但奇怪地不顯示它。HTML設置正確但不會顯示

意思是,如果我沒有點擊問題標籤,我會看到每個標籤點擊的錯誤信息,而不是僅僅看到第一個標籤。

我錯過了什麼?

http://jsbin.com/xaguzujo/1/

$("#issuesandsettings a").on("click", function(event) 
{ 
event.preventDefault(); 
    console.log("Fire"); 
if ($(this).html() == $("#issuesandsettings").find(".submenu").children("li").children("a").eq(0).html()) 
{ 
$("#panel").css("margin-left", "0px"); 
$("#issuesandsettings").css("float", "left"); 
} 
else 
{ 
console.log("And a miss"); 
    $("#error2").html("Oops, that isn't the Issues or Settings tab!"); 
    console.log($("#error2").html()); 
setTimeout(function() 
{ 
$("#error2").fadeOut("slow"); 
},1567); 
} 
}); 

回答

0

你第一次點擊將調用此: $( 「#誤差2」).fadeOut( 「慢」);

此功能將隱藏div。之後,如果要顯示錯誤消息,則需要調用$(「#error2」)。show();

+0

就是這樣,謝謝! :) – LSD

相關問題