I'm having a little trouble calling my CSS animation with jQuery. Basically, if the value of the input is nothing, I want the form to wobble (implying something is wrong). I tried using .addClass, but it still doesn't work.
HTML
<form id="form">
<input type="text" id="fld"/>
<button id="btn">Get</button>
</form>
CSS
form {
display: block;
margin: 0 auto;
width: 340px;
padding: 55px 0 0 0;
-webkit-transition: webkit-transform .75s ease-in-out;
}
.someAnimation {
-webkit-animation: errorAlert .75s ease-in-out;
}
@-webkit-keyframes errorAlert {
0%{
-webkit-transform:translateX(-20px);
}
25%{
-webkit-transform:translateX(20px);
}
50%{
-webkit-transform:translateX(-20px);
}
75%{
-webkit-transform:translateX(20px);
}
100%{
-webkit-transform:translateX(0px);
}
}
jQuery
$('#btn').on('click', function(){
if($('#fld').val() == null || $('#fld').val() == ""){
$('#form').addClass('.someAnimation');
}
});