我使用formValidation编写登录表单验证。现在我想在我的脚本中调用此函数。如何调用form_login函数?
(function(){
$.fn.validation = {
form_login: function(form){
$(form).formValidation({
icon: {
valid: 'fa fa-check',
invalid: 'fa fa-remove',
validating: 'fa fa-refresh'
},
fields: {
usernme: {
validators: {
notEmpty: {},
}
},
password: {
validators: {
notEmpty: {},
}
},
captcha: {
validators: {
notEmpty: {},
}
}
}
});
},
};
}());
答案 0 :(得分:-1)
与您的代码类似的用法示例(更短):
$.fn.test={
test_method: function(){alert('a');}
}
var div= "<div></div>";
$(div).test.test_method(); // it will output that alert