I am trying to invoke a script function on my MVC view as follows,
but it’s not happening. What may be the reason behind it?
<input type="text" id="hdnTemp" value="xyz" onload="test();" />
<script type="text/javascript">
function test() {
alert();
}
</script>
inputelements do not have anonloadevent.W3C Reference
You could use the
body‘sonloadevent, or another event in your input likeonclickoronchange, depending on what you want to do.