Answer the question
In order to leave comments, you need to log in
How to link to a div in jquery?
Good afternoon!
There is a js array
var myArray = [ "link":"url_1", "link":"url_2", "link":"url_3" ];
there is html:
<div> блок 1 </div>
<div> блок 2 </div>
<div> блок 3 </div>
Answer the question
In order to leave comments, you need to log in
I don’t understand where to shove the div url, but let’s say:
$('div').each(function(i,el){
$(el).text(myArray[i].link);
});
I'm writing from a phone, so it's sketchy: div -> onclick window.location.href = "www.sample".
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question