html - JavaScript Pass button id to an asp.net hiddenfield -


i got silly question question stated,the failed code shown below:

<script type="text/javascript">     function hisenlarge(id) {     var parent = id;     document.getelementbyid('hiddenfield1').value = parent;  } </script> 

html:

<button type="button"  id="kkkk" onclick="hisenlarge(this.id)"></button> <asp:hiddenfield id="hiddenfield1" runat="server" value=""/> 

vbcode

 protected sub commentbutton_click(sender object, e eventargs) handles commentbutton.click     dim c_id string     c_id = hiddenfield1.value.tostring 

document.getelementbyid('hiddenfield1').value = parent;

this not html hiddenfield1.so should reference clientid

document.getelementbyid('<%=hiddenfield1.clientid %>').value= parent;


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -