2011-09-09 35 views

回答

1
if(a) { 
    $('#link').hide(); // instead of .hide; 
}else{ 
    $('#link').show(); // instead of .show; 
    return; 
} 
2

你不是實際執行.show.hide方法...

應:

if(a) { 
    $("#link").hide(); 
}else{ 
    $("#link").show(); 
    return; 
} 
0

檢查:http://jsfiddle.net/TFBqf/14/

你實際上是檢查錯誤的東西,並使用這兩種情況的show方法(不使用括號的也可以)。

var a = $("#content div").html(); 

這將返回您div的實際內容。

0

作品:

$('#link')[$('#content:empty').length ? 'show' : 'hide']();