Sunday, 8 September 2013

How can I get current ajax-loaded content on location.hash change?

How can I get current ajax-loaded content on location.hash change?

Here is the way I can watch for hash state change:
function test() {
console.log(location.hash);
console.log(document.querySelector('h3.r').innerHTML);
}
window.onhashchange = test;
You can try this with google search page.
But I can see only element from previous page. What should I do to get
element of currently loaded content?
Lots of "Thank you" for vanilla.js solution!

No comments:

Post a Comment