Reputation:
My global variables aren't updating properly when I attempt the click below.
$(document).ready(function () {
var vote = undefined;
var more = undefined;
$(".sme").click(function (event) {
var vote = $(this).attr('id');
$(".sme").removeClass('clicked');
$(this).addClass('clicked');
$('.tick').fadeTo('fast', 0.8, function () {});
});
});
Any help would be appreciated, Thanks.
[RESOLVED]
Upvotes: 0
Views: 200
Reputation: 40358
You are again using var vote = $(this).attr('id');
inside click event
Replace it with vote = $(this).attr('id');
$(document).ready(function () {
var vote = undefined;
var more = undefined;
$(".sme").click(function (event) {
vote = $(this).attr('id');
$(".sme").removeClass('clicked');
$(this).addClass('clicked');
$('.tick').fadeTo('fast', 0.8, function () {});
});
});
Upvotes: 1