Skip to main content

Bug Tracker

Side navigation

#8725 closed bug (invalid)

Opened March 31, 2011 09:21AM UTC

Closed March 31, 2011 11:56AM UTC

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

Reported by: cbj@touristonline.dk 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?

Attachments (0)
Change History (2)

Changed March 31, 2011 11:54AM UTC by petersendidit comment:1

You just need to wrap the attribute value in quotes.

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

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

Changed March 31, 2011 11:56AM UTC by dmethvin comment:2

resolution: → invalid
status: newclosed

Quote the attribute.

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

"Attributes should be identifiers or strings."