Navigate to div section of a different html page using javascript in href -


i using javascript function jump div section on current html page(system_details.html):

<a href="javascript:show_processor()">processor</a> <a href="javascript:show_ram()">ram</a> 

however, want directly navigate system_details.html page's show_ram() function different html page (index.html)

give links , id <a href="javascript:show_ram()" id="ram">ram</a>. add id @ end of url using hash index.html#ram.

then use jquery this:

$(document).ready(function(){   if(window.location.hash) $('#' + window.location.hash).click(); }); 

this take last part of url after hash id of link clicked on, , call click() on link specified id.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -