I’m making a helper function that, amongst other things adds or removes a class. The function needs to be able to do either as there doesn’t seem any point in making two functions with the only difference being one adds a class the other removes it. So:
function kalf_addRow( type, action ) {
found = $("."+type).not(".row-vis").first();
found.slideDown();
$(found).[INSERT 'action' IN HERE]Class("row-vis");
}
I would pass it either “add” or “remove” as the “action” parameter and then need it inserted where shown. I would need to do similar for the slideDown too but it’s basically the same problem.
As asawyer said, you could use
toggleClass.Or another way would be to use an
if. Or you could do this