Using JQuery's toggle()
function, I have been able to hide and show some DIVs successfully.
Recently, I discovered relationships between certain DIVs that allowed me to group them into a class.
I decided to try toggling the entire class rather than individual DIV ids.
This is what I attempted:
$("#myDIVId1").click(function ()
{
$("myDIVClass").hide();
$("#myToggle1").toggle();
});
As opposed to this lengthy method:
$("#myDIVId1").click(function ()
{
$("#myToggle2").hide();
$("#myToggle3").hide();
$("#myToggle4").hide();
$("#myToggle5").hide();
$("#myToggle1").toggle();
});
However, only the verbose ID access seems to work. Any insights on why?