-2

Will there be any issue with CSS or jQuery if a YT video ID is used as the tag ID?
As in this example:

http://www.youtube.com/watch?v=_0qkIdfa3qY
<div id="_0qkIdfa3qY"></div> 
$('#_0qkIdfa3qY').html();

But consider that the ID can be anything with the the following characters:

ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-

I'm not seeing anything in the documentation regarding the use of upper/lower cases, numbers or the characters - and _. I wonder specially about numbers or scores in the beginning of the ID.

Community
  • 1
  • 1
brasofilo
  • 25,496
  • 15
  • 91
  • 179

2 Answers2

4

This may help, from the Selectors 3 Module:

In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit.

Perfect Dark
  • 191
  • 1
  • 5
  • It's not only that ID, I mean *any* ID. But then if the ID was `-0etc`, it would fall under "a hyphen followed by a digit", no? – brasofilo Apr 12 '13 at 19:57
  • Yes what you said is correct .. I thought I'd just provide a little more info since you didn't link the Selectors module .. which is a little newer – Perfect Dark Apr 12 '13 at 19:58
  • Well, I think that based on the docs you're linking, that we can safely say **"Yes, you will have issues. Don't use the video ID"**. I've made a slight modification in the Question to make clear that I posted only a random example. And, IMHO, I think you need to re-evaluate the sentence that I will not face issues... – brasofilo Apr 12 '13 at 20:13
  • I agree - thank you clarifying .. I also edited the last part of my answer. – Perfect Dark Apr 12 '13 at 20:16
2

You would probably be better off using the data attribute.

http://www.youtube.com/watch?v=_0qkIdfa3qY

<div data-videoid="_0qkIdfa3qY"></div> 

$('div[data-videoid=_0qkIdfa3qY]').html();
nickromano
  • 918
  • 8
  • 16