jQuery validation to allow only numbers OR only characters

Allow only numbers 
$(‘#zip’).keypress(function(event){

if(event.which != 8 && isNaN(String.fromCharCode(event.which))){

event.preventDefault();

}
});

Allow Characters with dots
$(‘#name’).keypress(function(event){

var inputValue = event.charCode;  if(!(inputValue >= 65 && inputValue <= 120) && (inputValue != 32 && inputValue != 0  && inputValue != 46)){

event.preventDefault();

}

});

Advertisements

Divs swapping based on window width & screen rotate

$(document).ready(function(){
/*Based on window width*/
if ($(window).width() < 767) {
$(“.mob-align-right”).insertAfter(“.mob-align-left”);
}

/*Sreen rotate event*/
$(window).on(“orientationchange”,function(){
if($(window).width() > 767){
$(“.mob-align-right”).insertAfter(“.mob-align-left”);
}else{
$(“.mob-align-left”).insertAfter(“.mob-align-right”);
}
});
});