Skip to main content

Bug Tracker

Side navigation

#3443 closed bug (fixed)

Opened October 03, 2008 11:11PM UTC

Closed February 26, 2010 05:43PM UTC

Last modified March 14, 2012 05:58PM UTC

Can't Select Attribute Values Containing Closing Square Bracket ]

Reported by: nickretallack Owned by:
Priority: major Milestone: 1.3
Component: docs Version: 1.2.6
Keywords: Cc:
Blocked by: Blocking:

Try it yourself. Add this element to a page:

<input type="text" name="foo[bar]" />

Then try to select it by name:


You get nothing, even if you try to escape it:



Playing around a little more shows that it's just the closing square brackets that break it, since $("[name*=foo[bar]") works.

Clearly it's parsing the first ] it sees as the end of the attribute selector. Any chance you guys can beef up the parser to handle this special case?

Attachments (0)
Change History (6)

Changed October 04, 2008 04:10PM UTC by flesler comment:1

Changed October 20, 2008 08:15PM UTC by posaune02 comment:2

resolution: invalid
status: closedreopened

I have read the FAQ regarding this issue, and still I am experiencing this same defect. Granted, the following are both invalid and will not function as intended:

$('[name=foo[bar]]'); and $('[name=foo\\[bar\\]]');

However, according to the FAQ, the following should work: $('[name=foo\\\\[bar\\\\]]');

It does not function as described in the FAQ.

Changed October 21, 2008 01:53AM UTC by flesler comment:3

component: selectordocs
resolution: → fixed
status: reopenedclosed

Indeed, you're right.

Posted this here.


Changed February 25, 2010 12:54PM UTC by omegasharp comment:4

resolution: fixed
status: closedreopened

$('input[name="foo[bar][blah]"]') works for both IE8 and FF3.5.8

However, I have a dropdown list, then:

$('select[name="foo[bar][blah]"]') works for IE8 but not for FF3.5.8.

Escape with \\\\[ \\\\] does not work either.

Also tried and not working in FF (since it's a select tag):


Changed February 25, 2010 01:16PM UTC by omegasharp comment:5

Sorry for the false alarm. It was other issues... Please close the ticket (delete my comments if possible).

Changed February 26, 2010 05:43PM UTC by john comment:6

resolution: → fixed
status: reopenedclosed