Skip to main content

Bug Tracker

Side navigation

#11398 closed bug (invalid)

Opened February 27, 2012 10:42AM UTC

Closed February 27, 2012 03:48PM UTC

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/

Attachments (0)
Change History (1)

Changed February 27, 2012 03:48PM UTC by timmywil comment:1

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.