Reputation: 1325
Is it possible to print out the value of a field without being rendered?
In other words, if I have an html like this:
<input value="'" />
And I do:
console.log( $('input').first().val() );
The result will be:
'
While, what I would like is the result to be:
'
is it possible?
Please note this is for debugging proposes only.
Upvotes: 0
Views: 1044
Reputation: 944545
The HTML entity is converted to the real character when the HTML is parsed and the DOM is created.
Your JavaScript runs much, much, later than that.
To get the original HTML you would need to make a new HTTP request to fetch the source code of the HTML document, and then write a custom parser (which didn't handle entities) to find the part of the HTML that interested you.
Upvotes: 3