is it possible to create a link to a div? this is my line of code:
output +='<h2><a href=\"link-to-a-website" >' + val.product + '</h2>';
I have created a rich internet application and I need this to link to a div within my website
is it possible to create a link to a div? this is my line of code:
output +='<h2><a href=\"link-to-a-website" >' + val.product + '</h2>';
I have created a rich internet application and I need this to link to a div within my website
Yes it is possible but you need to use ID
instead of CLASS
.
Example:
<h2><a href="#targetDiv" >' + val.product + '</a></h2>
<div id="topDiv">
</div>
<div id="targetDiv">
</div>
jsFiddle: https://jsfiddle.net/AndrewL32/45o6u4Le/2/
The target div could be on a different page/site too but you will have to specify the path correctly.