jQuery.NameSpace
发布时间:2014-08-06 编辑:www.jquerycn.cn
Easy way to create a namespace structure This plugin works for you to provide for your code a structure on namespaces. The Example: <script language="JavaScript"> <!-- $.namespace("validate", { isFullName: function(elems
Easy way to create a namespace structureThis plugin works for you to provide for your code a structure on namespaces.The Example:<script language="JavaScript">
<!--
$.namespace("validate", {
isFullName: function(elems){
return elems.val().indexOf(" ") > -1;
},
isNick: function(elems){
return elems.val().indexOf(" ") == -1;
},
isEmail: function(elems){
return elems.val().match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/);// erro;
}
});
checkFullName = function(){
($("#myFullName").validate.isFullName())? alert('Valid'): alert('invalid');
}Plugin page:http://gsaraiva.projects.pro.br/?page_id=52My site:http://gsaraiva.projects.pro.br/
<!--
$.namespace("validate", {
isFullName: function(elems){
return elems.val().indexOf(" ") > -1;
},
isNick: function(elems){
return elems.val().indexOf(" ") == -1;
},
isEmail: function(elems){
return elems.val().match(/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/);// erro;
}
});
checkFullName = function(){
($("#myFullName").validate.isFullName())? alert('Valid'): alert('invalid');
}Plugin page:http://gsaraiva.projects.pro.br/?page_id=52My site:http://gsaraiva.projects.pro.br/
您可能感兴趣的文章:
[关闭]