jQuery無法在下拉菜單中找到我的自定義屬性我有一個類似的只有一行上面,它很好,但這不斷給我一個未定義。jQuery找不到自定義屬性
的jQuery
$('#admin_student_school_select').change('click',function(){
var school_student = $(this+':selected').attr('school_student');
$('#admin_student_content_details')
.html(ajax_load)
.load(loadUrl,"form_being_submitted=admin_page_list_student&school="+school_student);
});
HTML
<select id="admin_student_school_select">
<option>Select a School</option>
<option school_student="1">Riverside Community College</option>
<option school_student="2">Victor Valley College</option>
<option school_student="3">Cal State San Bernardino</option>
<option school_student="4">Craffton College</option>
<option school_student="5">San Bernardino Community</option>
</select>
Ajax調用作品背後的腳本。我回應了結果。
是什麼'$(這+ ':選擇')'評估爲?在這種情況下,「this」不是DOM元素嗎? – 2012-04-09 05:08:16
你能告訴我們哪個變量是「undefined」嗎? – 2012-04-09 05:14:42
School_student。它找不到school_student屬性值。 – Cjueden 2012-04-09 05:16:15