2016-08-04 09:38:27 -05:00
|
|
|
var $textInput = $('[type="color"], [type="date"], [type="datetime"], [type="datetime-local"], [type="email"], [type="month"], [type="number"], [type="password"], [type="search"], [type="tel"], [type="text"], [type="time"], [type="url"], [type="week"], input:not([type]), textarea');
|
2016-07-29 08:57:28 -05:00
|
|
|
|
2016-08-04 09:38:27 -05:00
|
|
|
// Text Input Label Animation
|
|
|
|
$textInput.prev('label').addClass('loaded');
|
|
|
|
$textInput.each(function() {
|
2016-07-29 08:57:28 -05:00
|
|
|
if( $(this).val() ) {
|
|
|
|
$(this).prev('label').addClass('animate');
|
|
|
|
}
|
|
|
|
});
|
2016-08-04 09:38:27 -05:00
|
|
|
$textInput.on('focus', function() {
|
2016-07-29 08:57:28 -05:00
|
|
|
$(this).prev('label').addClass('animate');
|
|
|
|
}).on('focusout', function() {
|
|
|
|
if( !$(this).val() ) {
|
|
|
|
$(this).prev('label').removeClass('animate');
|
|
|
|
}
|
2016-08-04 09:38:27 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
// form error resolutions
|
|
|
|
$('form').has('.error').each(function(){
|
|
|
|
var $form = $(this);
|
|
|
|
|
|
|
|
$form.on('keyup', $textInput, function(){
|
|
|
|
$form.find(".error").addClass('resolve-error');
|
|
|
|
});
|
|
|
|
|
|
|
|
$form.on('change', $("[type=radio], [type=checkbox]"), function(){
|
|
|
|
$form.find(".error").addClass('resolve-error');
|
|
|
|
});
|
|
|
|
});
|