Bug Tracker

Opened 9 years ago

Closed 9 years ago

#8725 closed bug (invalid)

jQuery 1.5+ breaks working if ( is used in form element names

Reported by: cbj@… Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.5.1
Keywords: Cc:
Blocked by: Blocking:

Description

I'm combining Struts and jQuery. In Struts it's best practice to use () in form element names if one wants to insert a value in a mapped object serverside on submit.

For instance <input type="hidden" name="queryCondition(7447).key" value="yes"/> will set the value yes on the property key on the object 7447 in the map queryCondition.

This works perfectly with jQuery 1.4.4 and earlier but upgrading to 1.5+ results in the following error in Firefox:

uncaught exception: Syntax error, unrecognized expression: [name = queryCondition(7447).key]

It is possible to get the old working handling back please - perhaps controlled by a setting?

Change History (2)

comment:1 Changed 9 years ago by petersendidit

You just need to wrap the attribute value in quotes.

$('[name="queryCondition(7447).key"]')

http://jsfiddle.net/petersendidit/wRABN/

comment:2 Changed 9 years ago by dmethvin

Resolution: invalid
Status: newclosed

Quote the attribute.

http://www.w3.org/TR/CSS2/selector.html#matching-attrs

"Attributes should be identifiers or strings."

Note: See TracTickets for help on using tickets.