Check if multiple divs are visible at once

html, javascript, jquery

Solution

Try this :

$("#monday,#tuesday").is(':visible')

http://api.jquery.com/is/ : "... return true if at least one of these elements matches the given arguments".

Problem

I have been using the following code to check if a div is visible: ``` if ($("#monday").is(':visible')) { document.getElementById('scheduleitem1').style.width = 540; $("#scheduleitem1").show(); } ``` That code worked fine. However I want to check if one of multiple divs are visible at once. I've tried the following codes which did not work: ``` if ($("#monday" || "#tuesday").is(':visible')) { document.getElementById('scheduleitem1').style.width = 540; $("#scheduleitem1").show(); } ``` and ``` if ($("#monday", "#tuesday").is(':visible')) { document.getElementById('scheduleitem1').style.width = 540; $("#scheduleitem1").show(); } ``` So how do I do if I want to check if one of multiple divs are visible at once?

Original source