[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 660
  • Last Modified:

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
0
bill_home
Asked:
bill_home
  • 4
  • 3
1 Solution
 
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
 
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Marco GasiFreelancerCommented:
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
 
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now