Bug Tracker

Modify

Ticket #6694 (closed bug: invalid)

Opened 4 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 4 years ago by dmethvin

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":

<input id="sorry" type="date">
alert($("#sorry").attr("type"))

comment:2 Changed 4 years ago by tombigel

@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 3 years ago by rwaldron

  • Priority set to undecided
  • Status changed from new to closed
  • Resolution set to invalid

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.