Bug Tracker

Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#1041 closed bug (wontfix)

jQuery support for IDs with square brackets

Reported by: trucex Owned by:
Priority: major Milestone: 1.1.3
Component: core Version: 1.1.2
Keywords: selectors Cc:
Blocked by: Blocking:

Description

After some toying with it, I've had to revert a lot of my value changing code to just straight DOM manipulation with getElementById instead of using jQuery :(

No error is thrown, but no change is made either, when I perform a statement like the following:

$("#myid[0]").html("Hello World!");

Everything works fine, however, if I use document.getElementById("myid[0]").

Change History (2)

comment:1 Changed 15 years ago by aheimlich

Brackets are not legal characters in IDs, so I'm surprised that works at all.

FYI:

The (ID) attribute's value must begin with a letter in the range A-Z or a-z and may be followed by letters (A-Za-z), digits (0-9), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). The value is case-sensitive.

Source: http://www.htmlhelp.com/reference/html40/attrs.html#id

Though for CSS selectors, colons (":") and periods (".") are not allowed because they have special meaning in CSS selector syntax (though there is talk about adding some kind of support for these within jQuery)

comment:2 Changed 15 years ago by john

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.