Friday, July 13, 2018

Credit Card Year and Month Validation using JavaScript

---------------------------

Credit Card Year and Month Validation using jquery

$('[name=month]').change(function(){ if($('[name=month]').val()> 0){ var d = new Date(); var m = d.getMonth(); var y = d.getFullYear(); if($('[name=month]').val() < m){ $("[name=year] option[value='"+y+"']").remove(); }else{ if($("[name=year] option").eq(1).val() > y){ $("[name=year] option:first").after($('')); } } } }); $('[name=year]').change(function(){ if($('[name=year]').val()> 0){ var d = new Date(); var m = d.getMonth(); var y = d.getFullYear(); if($('[name=year] option:selected').val() == y){ for(i = 1; m > i; i++){ if(i <= 10){ i = '0'+i; } opt = i; $("[name=month] option[value='"+opt+"']").remove(); } }else{ if($("[name=month] option").eq(1).val() != '01'){ for(i = m-1; i > 0; i--){ if(i < 10){ i = '0'+i; } opt = i; $("[name=month] option:first").after($('')); } } } } });

Friday, January 27, 2017

difference between Chop and Chomp Chop: 1) Chop removes any last character from string or line. 2) This removes last character of the string and return that character $str = "How Are You"; chop($str); print $str; #output 'How Are Yo' $str = "How Are You"; $newStr = chop($str); print $newStr; #output would be 'u' -------------------------- Chomp: 1) this removes any special character at the end of the line or string 2) It removes characters at the end of strings corresponding to the $INPUT_LINE_SEPARATOR ($/) 3) It return number of characters removed $str = "How Are You\n"; chomp($str); print $str; #output would be How Are You', it removed special newline char '\n' $a = "How Are You\n"; $b = chomp($a); print $b; #it would be returning 1, it did removed one character something for sure

Thursday, October 27, 2016

How to get DIV Parent & Child value in Jquery





$(document).ready(function(){
	txtPrntMsg1 = $('.chld').parents('.parnt').text();
	alert(txtPrntMsg1);

	txtchldMsg1 = $('.parnt').children('.chld').text();
	alert(txtchldMsg1);
});

I am parent block I am child of Parent class parnt

How to get Radio Button value using name in Jquey




Two way Data Binding in AngularJS

FirstName :{{fname}} MiddleName : FirstName : MiddleName :

Basic of AnjularJs | AngularJs with Examples | One way-data


one way Data Binding in AngularJS

FirstName :{{fname}} MiddleName :