I have the following dropdown menu how can i redirect each menu to corresponding page by clicking each of menu? is it possible by using one javascript function if yes how?
thanks in advance…
<div>
<ul>
<li id=home onclick="show(this.id)"><a href="home.jsp">Home</a></li>
<li id=collection onclick="show(this.id)><a href="collection.jsp">Collection</a></li>
<ul>
<li id=men onclick="show(this.id)><a href="men.jsp">Men</a></li>
<li id=women onclick="show(this.id)><a href="women.jsp">Women</a></li>
</ul>
<li id=contact onclick="show(this.id)><a href="contact.jsp">Contact</a></li>
</ul>
</div>
If you only need o JS function to redirect based on a parameter that, in your case, is the component ID, this will do the work:
If you want to navigate DOM and get link’s href attribute use:
Considering that the first element inside the component referred by ID is a link tag.