Bug Tracker

Ticket #1041 (closed bug: wontfix)

Opened 2 years ago

Last modified 2 years ago

jQuery support for IDs with square brackets

Reported by: trucex Assigned to: anonymous
Type: bug Priority: major
Milestone: 1.1.3 Component: core
Version: 1.1.2 Keywords: selectors
Cc: Needs:

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]").

Attachments

Change History

Changed 2 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)

Changed 2 years ago by john

  • status changed from new to closed
  • resolution set to wontfix
Note: See TracTickets for help on using tickets.