Reputation: 185
I'm using jQuery to send an HTML document which contains a form to a C# WebService. The webService parse it and try to read "value" attribute of all inputs in the form.
The problem is that I send the HTML doc to the webservice with
var HTMLDoc = document.getElementById('foo').innerHTML;
And it does not returns the input with value attribute. For example, I got a :
<input type="text" id="foo" />
And I want the JavaScript to get :
<input type="text" id="foo" value="bar" />
when I do something like
document.getElementById('foo').innerHTML;
Is this possible ? Any idea ?
Upvotes: 0
Views: 297
Reputation:
you can try it
<input type="text" name="foo" id="foo" />
in Jquery :
var foo = $("#foo").val();
alert("Jquery foo value : " + foo);
in JavaScript :
var foo = document.foo.value;
alert("JavaScript foo value : " + foo);
Upvotes: 1