i have this function that will shuffle a list of images, when i press on a #shuffle button i want to trigger a message, if is confirmed the second time i will not want to ask again!
how to code this?
$('#shuffle').click(function(){
if(confirm('This will shuffle all your bla bla bla')){
$("#upimagesQueue li").shuffle();
}
});
You can use a variable, like this:
This starts with the confirm not being acknowledged, but the first time it is, it’s set to true. This means the first part of the
condition1 OR condition2in yourif()would be true, so the confirm wouldn’t pop up again.Alternatively, you can use
.data()to store the variable for this: