Friday, December 8, 2017

How do I test whether an element has a particular class in jQuery

$( "div" ).click(function() {
if ( $( this ).hasClass( "protected" ) ) {
$( this )
.animate({ left: -10 })
.animate({ left: 10 })
.animate({ left: -10 })
.animate({ left: 10 })
.animate({ left: 0 });
}
});

No comments:

Post a Comment