Question: I have a an input field `<input value="hello"/>`. How do I get what is in the value attribute in a cross-browser way? If I do `$input.attr('value')` or `$input.val()`, it returns the current value that the user has typed into the field, rather than the value that is set in the value attribute.

If I do `input.getAttribute('value')`, it returns what I want, but is that cross-browser compatible?

Answer: 
Use the [`defaultValue`](http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26091157) property:

```
input.defaultValue;

$("whatever").get(0).defaultValue;

```
Not enough points to add a comment to Blender

That works under Firefox, Chrome and Safari but don't work under IE (8). In IE you get the same behavior you have with jQuery. It returns the current value of the text box.