having a little issue with getting this simple if/else to work.
$(document).ready(function () {
$(".sme").click(function (event) {
var vote = $(this).attr('id');
$('.to').html(vote);
$(".sme").removeClass('clicked');
$(this).addClass('clicked');
});
});
$(document).ready(function () {
$(".tme").click(function (event) {
var more = $(this).attr('id');
$('.more').html(more);
if (typeof vote) {
$('.error').html("ERRRROOORRRR");
} else {
$(".tme").removeClass('clicked');
$(this).addClass('clicked');
}
});
});
Having an issue getting the if/else to work.
Any help would be great, Thanks!
voteis a string, so it is not boolean :) you must compare it to something. It does not work like inPHP$vote = "1";if ($vote)...typeof vote