Monday, June 4, 2012

In JavaScript(jquery) validation - text box without commas

Html Code:


Full Name:


Jquery
---------------------------------
jQuery.validator.addMethod("noCommas", function(value, element) {
return this.optional(element) || /^\s*(\w+(\s* \s*\w+)*)?\s*$/.test(value);
}, "Enter full name without commas");

jQuery(document).ready(function () {
$('#mainForm').validate({
rules: {
<%=txtBillingInfoFullName.UniqueID %>:{required:true, noCommas:true}
}
});
});
---------------------------------------------------
Output:
--------------->>>
-------------------------------
dfjkfjl 000 0huih jhjkh 6898
-------------------------------

No comments:

Post a Comment