這可能看起來很簡單,但花了近5小時後我找不到。 我裏面<c:foreach>
Jquery褪色問題
<a href="#" class="helpTip1" id="removeId">
<span id="helptext1" class="help_txt1">
<span class="help_txt1" id="helptxtContent">
help text goes here </span>
</span>
</a>
以下HTML元素然後,我有以下的jQuery。
var hide = false;
$(document).ready(function() {
$("#removeId").click(function(){
if(hide==true){
$("#helptxt1").fadeIn('slow');
$("#helptxtContent").fadeIn(function(){hide = false;});
}
if(hide==false){
$("#helptxt1").fadeOut('slow');
$("#helptxtContent").fadeOut(function(){hide=true;});
}
});
});
的問題是隻有當我點擊第一個elelmetn與id=removeid
的幫助文件越來越褪色。 當我點擊第二個元素(因爲它裏面的C:foreach
),這個jquery不起作用。
請幫我一把。
ID應該是唯一的,你需要使用類,而不是 –
@LogicBurner:OP提及ID爲錨標記'removeid'將在第一個元素的情況下工作。 OP有一個與同一個ID爲'removeid'的錨點不起作用。 – Unknown
我想要幫助文本淡出時點擊id id removeId –