In our markup, we often use full URLs as ids.
example:
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:
- var myid = "http://anode.com/someidhere" ;
- var container = $ ( '#scroll_propr' );
- container . scrollTop ( $ ( '#' + myid ). offset (). top - container . offset (). top + container . scrollTop () );
This fails with:
I've also tried this:
- $('#' + 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?