<div id="ranking">
<div id="ranking_wrapper">
<h5>Select site ranking</h5>
<img src="images/star.png" width="23" height="23" alt="" border="0">
<input type="hidden" name="sitename" value="webcamking">
<input type="radio" name="rank" value="1">1
<input type="radio" name="rank" value="2">2
<input type="radio" name="rank" value="3" checked="checked">3
<input type="radio" name="rank" value="4">4
<input type="radio" name="rank" value="5">5
<img src="/images/star.png" width="23" height="23" alt="" border="0">
<p><input type="submit" value="Rank This Site" id="rank_submit"></p>
</div>
<div id="response" style="display:none;" >
<h5>Loading...</h5>
<img src='images/ajax_loader.gif' class='img_center'/>
</div>
</div>
<script>
$("#rank_submit").click(function(){
$("#ranking_wrapper").fadeOut(0);
$("#response").fadeIn('slow');
$("#response").fadeOut('slow',function(){
$("#ranking").html('<div id="response" style="display:none;"> Thanks you for ranking webca.</div>');
});
});
</script>
问题是,元素淡出后不久,它就不会将div元素添加到排名div。
$("#response").fadeOut('slow',function(){
$("#ranking").html('<div id="response" style="display:none;"> Thanks you for ranking webca.</div>');
});
回调函数不工作..为什么?!!?
答案 0 :(得分:1)
#response
已经进入dom #ranking
存在div
有display: none
(所以你看不到它)答案 1 :(得分:1)
因为你有这个
<div id="response" style="display:none;">
您正在将html更改为,因此它显示为none,因此您将看不到它
答案 2 :(得分:1)
为什么你要添加属性style =“display:none”
替换代码
$("#ranking").html('<div id="response" style="display:none;"> Thanks you for ranking webca.</div>');
$("#ranking").html('<div id="response"> Thanks you for ranking webca.</div>');
答案 3 :(得分:0)