I'm trying to make a jquery function work on classes with a unique identifier.. But it seems like it isn't adding the var to the element... How do I do this
My code is this...
var x = 1;
$('.newest_posts').each(function() {
$('.showFull' + x).on('click', function(e) {
$('.newest_small' + x).hide(); // hide image preview on delete click
$('.newest_full' + x).show(); // hide image delete link on click
e.preventDefault();
});
x = x + 1;
});
Not very well versed in jquery but i'm stumbled because I have this code which works for hiding them first
var i = 1;
$('.newest_posts').each(function() {
$('.newest_full' + i).hide();
i = i + 1;
});