javascript - Set the value of an input field inside a form with a specific attribute? -


i have below html. need jquery selector set value of hidden attribute (selectedentityid) inside form following attribute (data-ajax="true"):

    <form  action="/myserver/list/toolbarfunction" method="post">     <input name="selectedentityid" id="selectedentityid" type="hidden" value="">     </form>      <form  action="/myserver/list/ajaxtoolbarfunction" method="post" data-ajax="true" data-ajax-success="successmessage" data-ajax-method="post" data-ajax-failure="failmessage">     <input name="selectedentityid" id="selectedentityid" type="hidden" value="">     </form> 

notes: need input element (selectedentityid) inside 2 forms , have same id.

i have tried following:

$("form[data-ajax='true'] #selectedentityid").val('123') 

but value not set , there arre no errors in browser console.

id should unique in page. can use name select element

$("form[data-ajax='true'] input[name='selectedentityid']").val('123') 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -