Skip to main content

Bug Tracker

Side navigation

#11258 closed bug (invalid)

Opened January 31, 2012 12:35AM UTC

Closed January 31, 2012 12:55AM UTC

Last modified May 08, 2012 06:15PM UTC

.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)

Attachments (0)
Change History (2)

Changed January 31, 2012 12:55AM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

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.

Changed May 08, 2012 06:15PM UTC by anonymous comment:2

var inputs = $('html').find("input:text");

$.each(inputs,function(){

$(this).attr('value',$(this).val());

});