Opened 13 years ago
Closed 12 years ago
#6694 closed bug (invalid)
The selector $('input[type=date]') does not work in ie6
Reported by: | tombigel | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.4.3 |
Component: | selector | Version: | 1.4.2 |
Keywords: | input type date html5 | Cc: | |
Blocked by: | Blocking: |
Description
I'm trying to select <input type='date'/> elements, (html5 type attribute), can't make it work on ie6, works on Webkit/Gecko browsers, don't have another ie version to test it on.
I also tried all the [name=value] variants ($,*,~), didn't work.
I made a small test script and getAttribute('type') returns 'date' so I can't think of a reason for this to happen.
Change History (3)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
@dmethvin
in your example document.getElementById('sorry').type returns "text"
but
document.getElementById('sorry').getAttribute('type') returns "date"
so ie6 can "see" type=date, it's just a matter of how the framework tries to access this info
comment:3 Changed 12 years ago by
Priority: | → undecided |
---|---|
Resolution: | → invalid |
Status: | new → closed |
HTML attributes are not the same as JavaScript properties.
document.getElementById('sorry').getAttribute('type') returns "date" - Yes, because that's what the value of the attribute says, however, because IE6 doesn't know what a type="date" input element is, it falls back to "text".
I think the problem is that any non-HTML5 browser uses the dynamic type property of "text" for any input type attribute that it doesn't understand.
http://www.w3.org/TR/html401/interact/forms.html#h-17.4.1
For both the selector and .attr(), jQuery is looking at the dynamic type property rather than the attribute. For the test below, IE and Firefox alert "text" rather than "date":