Reputation: 5005
Ok so i have two div's which are hidden using jquery's .hide();
onload
I have two function to .show();
them
function showIncorrectChar()
{
$("#csq-incorrect-characters").show();
}
function showMinChar()
{
$("#csq-min-characters").show();
}
Using Jquery/Javascript i need to find whether one of those div's are visible if they are i want it to do nothing if they aren't i need to call it
hideResultsTableContainer();
showResultsTree();
Upvotes: 2
Views: 1137
Reputation: 4389
if ($("#csq-incorrect-characters:hidden")) {
hideResultsTableContainer();
showResultsTree();
}
will call the functions if the element with an id #csq-incorrect-characters
is hidden
Upvotes: 1
Reputation: 852
if($('#divName').is(':visible')({ ... } to check if the div is visible or not
Upvotes: 1
Reputation: 4273
try
if ( $('#myitem').is(':hidden')){
// perform logic if the item is hidden
}
Upvotes: 1
Reputation: 337560
Use the :visible
selector.
if (!$("#csq-incorrect-characters").is(":visible") || !$("#csq-min-characters").is(":visible")) {
// either element is not visible - run your functions:
hideResultsTableContainer();
showResultsTree();
}
Upvotes: 4