Opened 14 years ago
Closed 13 years ago
#6160 closed bug (fixed)
attr() not sets value correctly
Reported by: | Christian Haller | 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 (4)
Changed 14 years ago by
Attachment: | Bildschirmfoto 2010-02-24 um 12.31.31.png added |
---|
comment:1 Changed 14 years ago by
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?
comment:2 Changed 14 years ago by
@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.
comment:3 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
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.
alert in opera 10.5 on mac