Solved

jquery selector no longer working in version 2.1.0.min

Posted on 2014-04-08
7
551 Views
Last Modified: 2014-04-08
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
Comment
Question by:bill_home
  • 4
  • 3
7 Comments
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 39986520
Are you sure? I usually use # not @ for id

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

Or it's a typo?
0
 

Author Comment

by:bill_home
ID: 39986528
no not a typo
it has been that way for a long time. I searched back releases.
0
 

Author Comment

by:bill_home
ID: 39986534
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 31

Accepted Solution

by:
Marco Gasi earned 500 total points
ID: 39986551
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
 

Author Closing Comment

by:bill_home
ID: 39986571
That was it thanks for the fast response
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 39986581
I'm happy to help you, we have been lucky: I never heard about @ in jquery! ;-)
0
 

Author Comment

by:bill_home
ID: 39986602
Every upgrade we find some interesting "changes".  

Thanks Again
Bill
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

774 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question