0
我想在div元素,但由於某種原因,每次我預覽我的腳本代碼,它只是顯示它並沒有運行爲什麼不是這個點擊處理程序的fadeToggle代碼工作?
我的腳本代碼的時間褪色是 -
<script>
$("#t<?php echo $pNumber ?>").click(function() {
$("#b.<?php echo $pNumber ?>").fadeToggle("slow", "linear");
});
</script>
的PHP變量用於更改div id的這是否會導致問題?
感謝,
更新 -
例如HTML這是div的之一(ID遞增)
<div id="t1">Carl Froch 'fitter than ever' for Andre Ward Showtime Super Six fight</div>
<div id="b1"><p>Carl Froch gives Andre Ward seven years but no encouragement to believe their fight on Saturday night is a war of the ages.</p><p>The 34-year-old WBC champion from Nottingham rarely strays far from the 12-stone limit of his division and is hard o...<p><a href=http://www.guardian.co.uk/sport/2011/dec/14/carl-froch-andre- ward-showtime-super-six>Click here for full article</a></p> </div <script>
$("#t1").click(function() {
$("#b1").fadeToggle("slow", "linear");
});
</script>
JB
你可以做的精簡樣本你的HTML,並將其添加到問題?如果沒有它,很難回答這個問題。 – 2011-12-15 02:43:03