Does anyone know how to write the following in a neater, one line format? I'm sure it's possible but can't get very far with it.
if($('#myDiv').hasClass('hidden')){
$('#myDiv').toggleClass('shown hidden');
}
Basically to only perform a toggle in one direction.
Many thanks,
Tom.
$('#myDiv.hidden').toggleClass('shown hidden');
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