Skip to main content

Bug Tracker

Side navigation

#1972 closed bug (worksforme)

Opened November 26, 2007 02:55PM UTC

Closed November 27, 2007 03:44PM UTC

I can not catch element if there is "[", "]" symbols in id. example: alert($jq('#i[4]').attr('id'));

Reported by: phoenix Owned by:
Priority: major Milestone: 1.2.2
Component: core Version: 1.2.1
Keywords: Cc:
Blocked by: Blocking:
Description
I can not catch element if there is "[", "]" symbols in id. example: alert($jq('#i[4]').attr('id'));

but I can catch such elements by getElementById function.
Attachments (0)
Change History (1)

Changed November 27, 2007 03:44PM UTC by davidserduke comment:1

description: I can not catch element if there is "[", "]" symbols in id. example: alert($jq('#i[4]').attr('id')); \ \ but I can catch such elements by getElementById function.{{{ \ I can not catch element if there is "[", "]" symbols in id. example: alert($jq('#i[4]').attr('id')); \ \ but I can catch such elements by getElementById function. \ }}}
resolution: → worksforme
status: newclosed

That is because those are reserved characters for the jQuery system. To use them you have to escape them with backslashes. Read here for more.

http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_that_has_weird_characters_in_its_ID.3F

See the example in the wiki also.

http://docs.jquery.com/Selectors/id