I want to pass this function a True or a False and have the elements listed show (true) or hide (false) on this input.
I am currently using this function...
function SetElementVisibility(visible) {
if (visible) {
$("#Div1").show("slow");
$("#Div2").show("slow");
$("#Div3").show("slow");
}
else {
$("#Div1").hide("slow");
$("#Div2").hide("slow");
$("#Div3").hide("slow");
}
}
But i would prefer to not repeat myself by naming the Div's for each outcome.
How can i refactor this into a more DRY (Don't Repeat Yourself) example?
Thanks, Kohan