javascript - jQuery select2-offscreen class with drop list? -
i making little project mvc4, c#, razor engine , jquery. in code have drop list, , every time item selected in drop list want send ajax request info selected, plus id of order in html:
<input type="hidden" id="materialrequestid" value=@myid />
to accomplish this, when user selects item in drop list, seek closest/sibling/find
html tag using id, failing because $(this)
seems have class of select2-offscreen
, everytime utilize 1 of previous jquery functions, undefined.
$('#officeid').change(function () { alert($(this).closest("div").siblings("#materialrequestid").value;); });
this html:
<td> <input type="hidden" id="materialrequestid" value=4 /> <div class="hide officelist"> <select id="officeid" name="officeid"> <option value="18">amaalb</option> <option value="19">amabgr</option> <option value="20">amacro</option> </select> </div> </td>
what missing here? why not working?
if value direct
$("#materialrequestid").attr("value");
and create sure 1 element per page has unique id should work
javascript c# jquery html asp.net-mvc-4
No comments:
Post a Comment