How get the value of hidden input that is in MVC view, in the JavaScript/Type Script File? Without use of jQuery please.
This is my input:
<input type="hidden" value="@Model.GridHeader" name="gridheader" id="gridheader" />
<input type="hidden" value="@Model.GridData" name="griddata" id="griddata" />
I tried these but non are working, they all return null value.
window.onload = function () {
var gridheader = document.getElementById("gridheader").innerHTML;
var griddata = document.getElementById("griddata").innerHTML;
alert(gridheader );
I already tried innerText
and textContent
.