I want to change the value of a variable while toggling a button. Based on this I want to toggle the rotation of an icon via CSS
// this is the variable I want to change
var flag;
$(".outer_rotate_aero").click(function() {
$(".outer_rotate_aero_fa1").toggleClass("down");
flag = false;
$(".rotate_aero1").click(function() {
flag = true;
$(".fa2").toggleClass("down");
});
// I want to toggle a class containing a icon (ie rotate)
if (flag == true) {
$(".fa2").toggleClass("down");
}
});
toggleClass()within a single click handler.$(".rotate_aero1")click event each time you click on$(".outer_rotate_aero"). And use.on('click', handler)notclick();