Read boolean HTML attributes with jQuery

Friday, 1 January 2010 @ 13:02

After much testing, I have concluded that in order to use jQuery with boolean attributes (and have it work in the big four browsers), the following markup must be used: checked=”checked”.

While browsers except any of the following…

checked
checked=""
checked="true"
checked="1"
checked="checked"

…only the last option works with jQuery in all browsers.

respond to post

You must be logged in to post a comment.

responses

  1. clsslc2010/1/22 @ 17:05

    Which shouldn’t be entirely surprising as that is the only valid value for the attribute, according to W3C[1].

    [1] http://www.w3schools.com/TAGS/tag_input.asp

pages

categories

events

syndication

random members

Utah PHP Users Group

recent posts

recent comments

recent job announcements

search

C7 Data Centerscolocated at C7 Data Centers
administered by Anavi Design