javascript - Getting HiddenField value upon clicking the button -


i want value of hiddenfield when clicking button but parentnode of button clicked.

<div id="wrapper">   <div id="gameinfo">      <input type="text" id="gametitle" disabled="disabled" />      <input type="text" id="gametype" disabled="disabled" />      <input type="text" id="gameprice" disabled="disabled" />      <asp:hiddenfield runat="server" id="hiddenf">      <input type="button" id="button1" value="enable" onclick="myfunc(this)" /> </div> </div> 

so have javascript here when clicked button gets parent node of button , enables fields in parent div can see, way incorporate function? need able value in code behind once have retrieved value hidden field.

function myfunc(elm){ for( var inputs = elm.parentnode.queryselectorall('input[type="text"]')   ,          l = inputs.length   ; l--   ; inputs[l].disabled = false  //enable inputs   ); //end loop } 

if cant set id static, have it:

var value = elm.parentnode.queryselector('input[type=hidden][id$="hiddenf"]').value; 

queryselector exists element, , inside of it.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -