#11258 closed bug (invalid)
.html() ignores current text input value
Reported by: | matteosistisette | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
html() on text input fields doesn't include the current value of the input field into the "value" attribute of the html tag.
E.g.: http://jsfiddle.net/uRCnK/2/
Expected console output: input type="text" id="textfield" value="aaaa"> Observed console output: input type="text" id="textfield">
Or type "xyz" into the text field and click te "print" button Expected console output: input type="text" id="textfield" value="xyz"> Observed console output: input type="text" id="textfield">
I am not sure, though, whether this is a bug in jQuery or in the Javascript engine itself (i.e. the implementation of the innerHTML property)
Change History (2)
comment:1 Changed 11 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 11 years ago by
var inputs = $('html').find("input:text"); $.each(inputs,function(){ $(this).attr('value',$(this).val()); });
Works the same with or without jQuery. That's just not the way dynamic properties work. If the user has their name half-typed into the field and you clone the element you can't expect the half-typed input in the html.