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.
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')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With