2
In my jQuery selector experiments I came across something that I don’t know is my mistake or is a natural limitation of jQuery.
I have 10 Ivs with classes .dado
. Each, when clicked, changes the event onclick
of another (single), which has the id #download
.
Only the first 5 should change the onclick
of the div #download
. I tried to use the lt() selector for this, but saw that it does not roll. All 10 Divs receive the function.
As I did:
$(document).ready(function(){
$(".dado:lt(5)").click(function(){
$("#download").attr("onclick", "href('http://meulink.com')");
});
});
He really can’t do it, I screwed something up or he’d have an alternative solution?
There is nothing wrong with your script. Review the HTML markup.
– Maujor