2013-04-23 37 views
0

這個jQuery選擇工作,我有這個網站:爲什麼在鉻,但不能在Firefox

<div id="PaymentTypeOptions"> 
    <input type="radio" id="payment_Cash" name="PaymentTypeOption" value="1">Cash 
    <input type="radio" id="payment_Card" name="PaymentTypeOption" value="2">Card 
    <input type="radio" id="payment_Cheque" name="PaymentTypeOption" value="3">Cheque 
    <input type="radio" id="payment_Voucher" name="PaymentTypeOption" value="4">Voucher 
</div> 

,我試圖以使用jQuery將它們綁定到一個事件來選擇所有的輸入類型:

$('document').ready(function() { 
    $('input:radio[name=PaymentTypeOption]').on('click', function() { 
    ShowPaymentType(this); 
    }); 
}); 

該選擇器適用於Chrome,但不適用於Firefox。 我很感激爲什麼會這樣。從$('document')去掉引號後

回答

1

嘗試:

改變這一點:

$('document').ready(function() { 

這樣:

$(document).ready(function() { 
+0

它在Chrome中如何工作? – 2013-04-23 10:33:08

+0

@JanDvorak我從來沒有在chrome中用引號試過。 – Jai 2013-04-23 10:36:55

+0

這沒有什麼區別。 – tticom 2013-04-23 10:42:58

0

這樣看來,火狐持有到一些JavaScript值。 說實話,我不確定這是怎麼回事,但關閉瀏覽器並打開一個新的導致問題消失。

相關問題