how can i check a if an element is visible or hidden with jquery and perform some action?
below given is my form related code,
<form>
First name: <input type="text" name="firstname"><br>
Last name: <input type="text" name="lastname"><br>
Full name: <input type="text" name="fullname"><br>
DOB: <input type="text" name="dob">
Address: <input type="text" name="address">
</form>
i need to hide the full name text field when first name text field or last name text field is displaying.
try something like this
if($('#testElement').is(':visible')){
//what you want to do when is visible
}
for your code
if($('input[name="firstname"], input[name="lastname"]').is(':visible')){
$('input[name="fullname"]').hide();
}
REFERENCE
http://api.jquery.com/visible-selector/
if($('input[name="firstname"], input[name="lastname"]').is(':visible') === true)
$('input[name="fullname"]').hide();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With