1
任何人都可以告訴我爲什麼這不起作用,我需要做什麼才能使它工作?使用Jquery在iFrame的下拉菜單中設置.change功能
$("#rptframe").contents()
.find('#customerjax')
.change(function() { alert("yeah"); })
.change();
感謝任何人都可以幫助!
任何人都可以告訴我爲什麼這不起作用,我需要做什麼才能使它工作?使用Jquery在iFrame的下拉菜單中設置.change功能
$("#rptframe").contents()
.find('#customerjax')
.change(function() { alert("yeah"); })
.change();
感謝任何人都可以幫助!
這是一個工作JSFiddle。你的問題基本上是你不訪問Iframe中的元素。您必須在Iframe元素上使用.contentWindow.document
才能深入查看框架內容。
這也許應該工作:
$($("#rptframe")[0].contentWindow.document)
.find('#customerjax')
.change(function() { alert("yeah"); })
.change();
嘗試更換你的最後'.change();'和'.trigger( '變');' – MilkyWayJoe
假設元素'#customerjax'能夠燒成當然是一個'變化'事件 – MilkyWayJoe