/*! * Validate */ (function($){$.validate=[];$.validate.defaults={classError:"error",selectDefaultValue:0,redirect:!0,inline:!1,inlineEvent:"focusout",onItemValidate:null,onItemError:null,onValidate:null,onError:null,};$.validate.form=function($form,options){var result=!0;if(!options){options=$form.data("validate")} $form.find("[required]").each(function(){var itemResult=$.validate.item($(this),options);result=result&&itemResult});return result};$.validate.item=function(item,options){var result=!0;item.removeClass(options.classError);item.parent(".select").removeClass(options.classError);if(item.is(":disabled")){return!0} if($.isFunction(options.onItemValidate)){options.onItemValidate.apply(item,new Array(item,options))} if(item.is("select")){result=item.val()&&item.val()!=options.selectDefaultValue?!0:!1}else if(item.is(":checkbox")||item.is(":radio")){var inputName=item.attr("name"),checked=$('input[name="'+inputName+'"]:checked').length;result=checked==0?!1:!0}else{result=item[0].checkValidity()} if(result==!1){item.addClass(options.classError);item.parent(".select").addClass(options.classError);if($.isFunction(options.onItemError)){options.onItemError.apply(item,new Array(item,options))}} return result};$.fn.validate=function(options){if(!$(this).is("form")){return!1} var options=$.extend({},$.validate.defaults,options);$(this).attr("novalidate","novalidate");$(this).data("validate",options);$(this).on("submit",function(){if($.validate.form($(this),options)){if($.isFunction(options.onValidate)){options.onValidate.apply(this,new Array(this,options))} return options.redirect?!0:!1}else{if($.isFunction(options.onError)){options.onError.apply(this,new Array(this,options))} return!1}});if(options.inline){$(this).find("[required]").on(options.inlineEvent,function(){$.validate.item($(this),options)})}}})(jQuery); /*! * Events */ jQuery(function($){$("form").validate({classError:"error",});$(".alert .close").on("click",function(e){$(this).parent(".alert").remove();e.preventDefault()})}) ;