jquery selector no longer working in version 2.1.0.min

Hello Experts,

This selector worked in 1.7.1. min, now I am getting the following error in Chrome.  Does anyone know why?
 
 $('input:checkbox[@id]').filter(function () {



uncaught Error: Syntax error, unrecognized expression: input:checkbox[@id] jquery-2.1.0.min.js:2
bill_homeAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Marco GasiConnect With a Mentor FreelancerCommented:
I found this:

Note: In jQuery 1.3 [@attr] style selectors were removed (they were previously deprecated in jQuery 1.2). Simply remove the “@” symbol from your selectors in order to make them work again.

I found it here: http://api.jquery.com/category/selectors/attribute-selectors/
but they are speaking about jquery 1.2 and 1.3. I think your iussue could be similar and even the solution: try to remove the @ symbol and see what happens.
0
 
Marco GasiFreelancerCommented:
Are you sure? I usually use # not @ for id

 $('input:checkbox[#id]').filter(function () {

Or it's a typo?
0
 
bill_homeAuthor Commented:
no not a typo
it has been that way for a long time. I searched back releases.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
bill_homeAuthor Commented:
Here is the code up to the else statement

 function NodeChecked(currentNode) {
                   var id = currentNode.id;
                   var currentCheckbox = $('#' + id);

                   if (currentCheckbox.is(':checked') == true) {

                       // It's a primary node
                       if (id.indexOf('-') <= 0) {

                           $('input:checkbox[@id]').filter(function() {
                               var regex = new RegExp('^' + id + '-');
                               if ($(this).attr('id').match(regex) !== null) {
                                   $(this).prop('checked', true);
                               }
                           });
                       }

                   } else {
0
 
bill_homeAuthor Commented:
That was it thanks for the fast response
0
 
Marco GasiFreelancerCommented:
I'm happy to help you, we have been lucky: I never heard about @ in jquery! ;-)
0
 
bill_homeAuthor Commented:
Every upgrade we find some interesting "changes".  

Thanks Again
Bill
0
All Courses

From novice to tech pro — start learning today.