Skip to main content

Bug Tracker

Side navigation

#6160 closed bug (fixed)

Opened February 24, 2010 11:32AM UTC

Closed June 18, 2010 01:50AM UTC

attr() not sets value correctly

Reported by: christianhaller Owned by:
Priority: Milestone: 1.4.2
Component: attributes Version: 1.4.1
Keywords: input, checkbox, value, cross browser Cc:
Blocked by: Blocking:
Description

http://christianhaller.com/input.html

Different values in checkboxes, no cross brower compatibility.

Look at my testcase.

Attachments (1)
Change History (3)

Changed March 01, 2010 10:01AM UTC by Licensed to Gil comment:1

I'm pretty sure that IE in particular won't allow you to change the type attribute on an input after it's been created, which I'm guessing is contributing to the difference in functionality.

I can't really see how jQuery could work around it.

What happens if you try $('<input type="checkbox" />').attr('value', 'foo') instead?

Changed March 01, 2010 11:01PM UTC by icfantv comment:2

@Gil is correct. In jQuery 1.3.x, there was a specific comment in the API docs about when creating <input> elements you needed to specify a type as part of the same string due to issues in IE. E.g., $('<input type="text"/>') creates a text field.

Unfortunately, am unable to find that comment in the 1.4 docs, but I'd be willing to bet that this hasn't changed.

Changed June 18, 2010 01:50AM UTC by dmethvin comment:3

resolution: → fixed
status: newclosed

Sorry, IE just won't let you (or jQuery) change the type of an input after it's created. I've updated the documentation of

jQuery()
to clarify this.