I have an html
form
with some input fields.
Instead of reading and sending the input
values โโof the document.ipForm.userName.value
fields, I need to send all the html content to the html parser and extract the pair <name ,value>
each input field by some other program (and other information too).
But when I did it in JavaScript (I want a clean JavaScript other library)
var contents=document.getElementById("formArea").innerHTML; alert(contents);
It does not show the value="enteredValue"
fields of the <input/>
fields, even if I entered some values.
My html file:
<html> <head> <script type="text/javascript"> function showInnerHtml(){ var contents=document.getElementById("formArea").innerHTML; alert(contents); } </script> </head> <body> <div id="formArea"> <form name="ipForm" > UserName : <input type="text" name="userName"> </form> </div> <div> other contents..... </div> <div onclick="showInnerHtml()">Show InnerHTML</div> </body> </html>
Something is missing or impossible.
Do not call me MAD. but I am struggling with this strange state.
source share