Asked by vinoy · · 2 answers
Often when checking if something is visible or not, jQuery chaining makes this simple.
So if you have a selector and you need to play out some activity on it only if is visible or hidden, you can utilize filter(":visible")
or filter(":hidden")
trailed by chaining it with the action you want to make.
if
statement example:
if ($('#btnUpdate').is(":visible"))
{
$('#btnUpdate').animate({ width: "toggle" }); // Hide button
}
You can do it all in one line:
$('#btnUpdate').filter(":visible").animate({ width: "toggle" });
0
0