lundi 7 novembre 2016

JQuery: if div is visible

I'm using JS as a way of changing the content of a SPA I'm creating. When I press a button to change the content the html changes from this:

<div id="selectDiv" style="display: none;">

to this:

<div id="selectDiv" style>

Now part of my SPA has a div that contains a number of checkboxes, each representing a div, and so when I press the submit button, the next div that should be displayed will be the first item in the checkbox list that was selected.

I'm wondering if there's a way in JQuery for the code to "almost detect" which div is now visible. something like this:

if($('#selectDiv').isVisible()){
    //JS code associated with this div.
}

Any suggestions?




Aucun commentaire:

Enregistrer un commentaire