Bug Tracker

Opened 7 years ago

Closed 7 years ago

#11398 closed bug (invalid)

Using .prop() on "required" in IE

Reported by: MrMamen Owned by:
Priority: low Milestone: None
Component: attributes Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

I'm trying to find the attribute "required" on a input field, but this failes in IE9 when using the .prop() function. While you could argue that IE doesn't support "required" and therefore the property should be false, this is not consistent, as IE8 and Safari doesn't support required either, but the prop returns true if the attribute is present. Even compability mode shows different behaviour.

Also isn't the point of jQuery's .prop() to avoid using .attr("required") === "required", and that it should work the same way in all browsers?

http://jsfiddle.net/mrmamen/yhLDK/

Change History (1)

comment:1 Changed 7 years ago by timmywil

Component: unfiledattributes
Priority: undecidedlow
Resolution: invalid
Status: newclosed

Firstly, Safari does support required (but will not stop form submissions if invalid input is entered). Secondly, IE6-8 does not set the required property to the boolean true, but the string "required". Anything other than the boolean true means that required is not supported.

http://jsfiddle.net/timmywil/yhLDK/3/

We certainly cannot change the property values and we should not hide their values with the .prop() method.

Note: See TracTickets for help on using tickets.