更新: 問題更復雜。看起來像它涉及手風琴頭沒有正確傳遞.click事件,並且與檢查選擇器無關。所有這個例子都在測試文件中正常工作。jQuery不返回檢查的電臺值
請參閱Radio input in header of accordion problem ?BUG
我有幾個無線電元素形式中,每個名字 「RX」(其中x爲1..3),.buttonset()施加。 與
比如:id = 3
alert ($('input:radio[name=r'+id+']').val());
//returns value of the first radio in the set
alert ($('input:radio[name=r'+id+']:checked').val());
//returns 'undefined', even one of the radios is checked.
,我都試過:checked')[0]
,:checked').get(0)
,:checked').attr('id')
我不知道爲什麼第一個方法返回一個值......這是否有什麼關係.buttonset添加類/元素?
任何意見是讚賞!
PS。 $('input:radio [name = r'+ id +']')。get(0) 返回[object HTMLInputElement],我想它應該的方式。但是這個對象沒有.html()或.val()方法。 $('input:radio [name = r'+ id +']:checked')。get(0)仍然是'undefined'。
PPS。強制隱藏UI-helper的可見性 buttonset不會爲原始無線電元素「更改」。 我想我可以使用.ui-state-active來檢查活動收音機,而不是...有什麼更好的方法?
@ selytch你需要什麼o/p? – 2010-07-17 07:56:02
是的,謝謝你告訴我們你有手風琴.... – redsquare 2010-07-17 08:32:56