我已經花了數小時試圖解決這個問題,但不能!與標題sais一樣,以下代碼適用於除Firefox之外的所有內容!jQuery .next()在FF中返回NULL,但不在chrome中,即opera!
HTML
<div class="bottom">
<fieldset>
<ul>
<li>
<label>
<input type="radio" name="fronts" class="config-inp-cha" value="1" checked="checked" />
Buckets w/ adj headrests
($<div class="price-config">179.97</div>)
</label>
</li>
</ul>
</fieldset>
</div><!--bottom-->
JavaScript的說明:很簡單,我抓住了價格配置div的價值參考選中的值。這在Firefox中返回NaN,但適用於所有其他瀏覽器! PLzzz幫助
$(document).ready(function()
{
var fronts_price = parseFloat($("input[name=fronts]:checked").next('.price-config').html());
alert(fronts_price);
});
人們經常使用行吟詩人r工具來評估可能發生的事情。請粘貼您的呈現源代碼,免費使用PHP標記。以這種方式使用jsfiddle.net之類的東西要容易得多! – 2011-04-08 18:55:20
對我來說看起來沒問題,並且在FF 4.0中爲你做了一個快速測試......它按預期提示179.97。 – Craig 2011-04-08 19:07:02
我只是不明白! 3.6正在給出問題,(mac版本)。 – 2011-04-08 19:11:34