Using URLs as ids

Using URLs as ids

In our markup, we often use full URLs as ids.

example:

  1. <li   role = "treeitem"   aria-selected = "false"   aria-level = "2"   aria-labelledby = "http://anode.com/someidhere_anchor"   aria-expanded = "false"   id = "http://anode.com/someidhere"   class = "jstree-node  jstree-closed" ><i   class = "jicon ocl" role = "presentation" ></i><a   class = "janchor"   href = "#"   tabindex = "-1"   id = "http://anode.com/someidhere_anchor" ><i class = "jicon jthemeicon"   role = "presentation" > </i> funnode </a></li>
In the HTML above, note the line  id = "http://anode.com/someidhere"

First question: is it ok to use a URL as an id in Jquery?

So, the HTML is inside a scrolling window on a web page. The scrolling window is:

<div id="scroll_propr">all the HTML is here</div>

What we want to do is have an id scroll in to view when it's selected. 
I've tried a couple of methods:

  1. var  myid  =   "http://anode.com/someidhere" ;
  2. var  container  =  $ ( '#scroll_propr' );
  3. container . scrollTop (  $ ( '#'   +  myid ). offset (). top  -  container . offset (). top  +  container . scrollTop ()   );

This fails with:

  1. Error :   Syntax  error ,  unrecognized expression :   #http://anode.com/someidhere

I've also tried this:

  1. $('#' + myid).get(0).scrollIntoView();

And it fails the same way.  I've tried escaping all the unusual characters but it still gives the
same message. Any ideas?