I'm trying to make a variable in a function, that I can then redefine using it again in a different function, and I was wanting to use jquery .data to do it but am unsure how.
I have this
$(".photo").click(function() {
var id = $(this).attr('id');
});
in the next function I'd like to redefine the id variable...using the previous id variable value, any ideas on how to do this?
$("#next").click(function() {
var id = $(id).next().attr('id');
});