0

Possible Duplicate:
What are valid values for the id attribute in HTML?

Hi, I'm struggeling with the jQuery UI Tabs and the needed ids. Let me give you an example:

<div id="tabs">
  <ul>
    <li><a href="#messages/pn1">Link</a></li>
    <li><a href="#messages/pn2">Link</a></li>
  </ul>
  <div id="messages/pn1"></div>
  <div id="messages/pn2"></div>
</div>

Now when I click on the second tab i get an exception like "jQuery UI Tabs: Mismatching fragment identifier." Isn't it allowed to user slashes in ids?

Community
  • 1
  • 1
Davincho
  • 300
  • 2
  • 8
  • Ok solved. That was was i needed: If you wish to use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[\]^`{|}~ ) as a literal part of a name, you must escape the character with two backslashes: \\. For example, if you have an element with id="foo.bar", you can use the selector $("#foo\\.bar"). From http://api.jquery.com/category/selectors/ – Davincho May 05 '11 at 07:34

2 Answers2

2

Sorry. HTML Spec indicates otherwise.

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

http://www.w3.org/TR/html40/types.html#type-name

IslandCow
  • 3,412
  • 3
  • 19
  • 24
1

It is not allowed. Take a look at here

Community
  • 1
  • 1
CdB
  • 4,738
  • 7
  • 46
  • 69