views:

44

answers:

1

Let's say I have custom HTML tags like so:

<fb:est hours="5">5 Hours</fb:est>
<fb:act hours="4">4 Hours</fb:act>

How do I select the fb:est elements?

Doing var e = $('fb:est') does not work. And var e = $('fb\:est') doesn't work either.

+8  A: 

From the jQuery docs:

If you wish to use any of the meta-characters (#;&,.+*~':"!^$=>|/@ ) as a literal part of a name, you must escape the character with two backslashes: \. For example, if you have an an input with name="names[]", you can use the selector $("input[name=names\[\]]").

So, this is the way to do it:

var e = $('fb\\:est')

Rob Sobers