Search code examples
javascriptjqueryjqtouch

Detect when <div> is shown


I have 4 <div>s in my code. I used JavaScript to show and hide them. Now it's getting hard to manage, thus I need to detect if a particular <div> is shown or hidden. I'm unsure on how to do this, which way would one code this? JQuery or Jqtouch can be good. thanks


Solution

  • Depends on how the divs are hidden exactly but you can probably use

    if(document.getElementById("myDiv").style.display=="none"){
        //do something
    }