javascript - How to get a asp variable into a html input variable -


i'm trying asp variable in javascript function, i'm trying pass variable through

<input type="hidden" id="abc" value="<% variable %>"> 

and value through

document.getelementbyid('abc').value; 

but gives me error, there better way or how can put asp variable input value?

try this:

<input type="hidden" id="abc" value="<%= variable %">

update:

<% %> refers generic code block. can still try , inside block say, <% response.write(variable) %>. won't return unless tell to.

<%= %> on other hand, shortcut <% response.write() %>


Comments