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

Javascript find highest and lowest from the given inputs

function highAndLow(numbers){ // numbers = "4 5 29 54 4 0 -214 542 -64 1 -3 6 -6"   let numbersInArr = numbers.split(' '...