I have a simple function that checks selected div ids, and performs an action if a particular div is present:
function checkContent_m(){
var mItems = [document.getElementById('m_round1'),document.getElementById('m_round2'),document.getElementById('m_round3'),document.getElementById('m_round4'),
document.getElementById('m_round5'),document.getElementById('m_round6'),document.getElementById('m_round7'),document.getElementById('m_round8')];
if (mItems.length > 0){
document.getElementById('m_div').style.display = "block";
}
else{
document.getElementById('m_div').style.display = "none";
}
}
Seems to me that there might be a way for me to construct my array more efficiently. How would I construct a regular expression that would be an equivalent to:
document.getElementById('m_round'+ '*')
Such statement would allow me to add an unlimited number of "m_round" divs, without having to modify my js function.
document.getElementsByClassName("myClass").mItems.length > 0? It is always true.data-*attributes..