jQuery cannot find my custom attribute on a drop down menu I have a similar one just one line above it that works great, but this keeps giving me an undefined.
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>
The script behind the ajax call works. I’ve echoed out results.
This line is invalid:
What is it, a
clickor achangeevent?!Update:
$(this+':selected')isn’t a valid selector…use this: