If we execute below code in Firefox 23, both alert boxes show correct value. When I execute the same in Chrome 28, second alert shows blank window.
HTML
<input type="hidden" id="mappingIDinput"/>
JS
alert(mappingId);
document.getElementById("mappingIDinput").innerHTML=mappingId;
alert(document.getElementById("mappingIDinput").innerHTML);
How can I save & retrieve value in hidden input field which works across browsers(ignore IE if required).
for input field use value not html to get their value
IN JAVASCRIPT
SET
document.getElementById("mappingIDinput").value="abc";
GET
alert(document.getElementById("mappingIDinput").value);
in jQuery
SET
$("#mappingIDinput").val("abc");
GET
alert($("#mappingIDinput").val());
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