I'm trying to turn my clicks into functions, since the code is being repeated in
This is the original code:
$("#div1").click(function() {
$("#widget-body1").slideToggle("slow");
});
$("#toggle1").click(function() {
$("#widget-body1").slideToggle("slow");
$('#toggle1').toggleClass(function() {
if ($(this).is('.fa fa-chevron-down')) {
return '.fa fa-chevron-up';
} else {
return '.fa fa-chevron-down';
}
})
});
This is the code I wanted to do:
function myfunc(par1) {
$(par1).slideToggle("slow");
};
$("#div1").click(myfunc("#widget-body1"));