I have the code bellow inside a wordpress loop, so the variable $perf and $url change every time.
<div class="link" data-performer="<? echo $perf; ?>">
<a class="performer_rp" href="<? echo $url; ?>">My anchor</a>
</div>
This jquery function ads the variable $perf to the link, on click.
function performer_rp(){
var perf;
perf = $(".link").data('performer');
$("a.performer_rp").click(function() {
this.href += "?perf="+perf+"";
});
};
Problem is, I get only the first value of $perf, it won't change with the loop.
So lets say the loop "loops" 5 times and I get 5 $perf values: value1, value2 ... value5.
The jquery code asigns the value1 everytime.
Why is that? Ty very much!