@name selector is deprected in jQuery, removed in jQuery 1.3@name selector is deprected in jQuery, removed in jQuery 1.3

Posted January 23rd, 2009 in Javascript

In my how to check and uncheck a checkbox with jQuery and how to get and set form element values with jQuery posts I used @name= selectors for some of the form elements but have since discovered the use of the @ was already deprecated and has been removed in jQuery 1.3.

One of my previous examples looked like this, to work out if a checkbox was checked:

$('input[@name=foo]').is(':checked')
$('input[@name=foo]').attr('checked')

To make the code valid for jQuery 1.3 you need to remove the @ symbols and do this instead:

$('input[name=foo]').is(':checked')
$('input[name=foo]').attr('checked')

The use of these selectors without the @ also works in the jQuery 1.2 branch. I am not sure if it works in older versions.

Related posts:

Share or Bookmark

Share or Bookmark this page using the following services. You will need to have an account with the selected service in order to post links or bookmark this page.

Subscribe or Follow

Subscribe via RSS or email, or follow me on Facebook or Twitter below. The RSS icon takes you through to Feedburner where you can select the service or application to use.

Comments

blog comments powered by Disqus