tags:

views:

282

answers:

1

I am getting uncaught exception: Syntax error, unrecognized expression: [@name='rbRewSelectionGroup'] when I load may page which has this in it at the bottom:

<script language="javascript">

    $("input[@name='rbRewSelectionGroup']").click(function()
                                                   {
                                                        $(this).closest("form").submit();
                                                   });
</script>

I am not seeing it. I do not see anything wrong with this code at all. I do have the jQuery (1.4.2) library loaded with the page.

A: 

In current versions of jQuery you no longer need the @ prefix for attributes (it was removed in the jQuery 1.3 release).

Your attribute-equals selector should look like this:

$("input[name='rbRewSelectionGroup']")
Nick Craver
so....looks like jQuery 1.4 is not backwards compatible with @?? that seems a bit odd
CoffeeAddict
@coffeeaddict: Neither was jQuery 1.3 :) It was released over a year ago...
Nick Craver
great. Because I just upgraded our code to jQuery 1.4.2 because I wanted to use the latest jQuery library with the new jQuery UI...I hope I did not break anything. I was told that for most all of the code in 1.3, that it's compatible with 1.4
CoffeeAddict
@coffeeaddict: Are you *sure* you are going from 1.3 to 1.4? It sounds like you were on 1.2.x previously, you can test it here: http://jsfiddle.net/eB9TL/ Change the framework on the left and click run, you'll see it errors in 1.3 and 1.4, but works in 1.2.
Nick Craver