Monday, August 27, 2012
Monday, August 13, 2012
Taxable Field Validation
Form Validation Example
--------------- Jquery ------------------$.validator.addMethod("taxAmount_validate", function(value, element, param) { var taxtype = $('#taxType').val(); if (taxtype >= 0) { if (taxtype == 0) { if (value <= 0) { return false; } else { return true; } } if (taxtype == 1 || taxtype == 2) { if (value != 0) { return false; } else { return true; } } } }); $("#taxForm").validate({ debug: true, //prevent submission for testing rules: { taxAmount: { taxAmount_validate: true } }, messages: { taxAmount: { taxAmount_validate: "Enter validate tax amount!." }, } });
Thursday, August 9, 2012
Zip code accept only 5 or 9 digits
HTML
Jquerty
$.validator.addMethod('zipcode', function(postalcode,element){ return this.optional(element) || postalcode.match(/^\d{5}$|^\d{5}\-\d{4}$/) || postalcode.match(/^\d{9}$|^\d{9}\-\d{8}$/); },"Please enter 5 or 9 digits valid zip code");
jQuery(document).ready(function () { $("#mainForm").validate({ rules: { txtBillingInfoPostalCode:{zipcode:true} } }); });
Wednesday, August 8, 2012
Allow only numbers in textbox jquery on key press
HTML
Jquery
$("#num").keypress(function (e){ var charCode = (e.which) ? e.which : e.keyCode; if (charCode > 31 && (charCode < 48 || charCode > 57)) { return false; } });
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(' ...
-
function highAndLow(numbers){ // numbers = "4 5 29 54 4 0 -214 542 -64 1 -3 6 -6" let numbersInArr = numbers.split(' ...
-
HTML Jquery $("#num").keypress(function (e){ var charCode = (e.which) ? e.which : e.keyCode; if (charCode > 31 ...
-
//Change the port connect: { options: { port: 8080 , // change this to '0.0.0.0' to a...