I have Hidden field like
<%= Html.Hidden("ID", 1) %>
and in javascript i want a value of that field by
var ID = document.getElementsByName("ID").value;
I can't access it!
is there any other way?
Try this :
<input type="hidden" id="ID" />
for javascript to access it :
var ID = document.getElementById("ID").value;
other way with JQuery :
var ID = $('#ID').val();
Not sure of the context but shouldn't you be using getElementById ??
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With