Jquery click out side menu hide / Card validation / Responsive jQuery window width

 click out side menu hide

/*-------------click out side menu hide-------------*/

  $('.menu').click(function(){
  $('.insideDiv').toggle();
  });

  $(document).mousedown(function (e){
  var container = $(".insideDiv");

  if (!container.is(e.target) // if the target of the click isn't the container...
  && container.has(e.target).length === 0) // ... nor a descendant of the container
  {
  container.hide();
  }
  });


Select > option changes into Ul li using jquery

jQuery('#mobile-menu').parent().append("<ul name='sideNavbar' class='sideNavbar'></ul>");
jQuery('#mobile-menu option').each(function(){
jQuery('.sideNavbar').append('<li value="'+ jQuery(this).val()+'"><a href="'+ jQuery(this).val()+'">'+jQuery(this).text()+'</a></li>');
});
jQuery("#mobile-menu").remove();

Card validation 
/*Card expiry date format start*/
jQuery('input#authorizenet_expiration_mon_yr').parent().append('<span class="cardExpirdate error hide">Card expiry date format MM/YYYY </span>');
jQuery('input#authorizenet_expiration_mon_yr').keyup(function(){
cardExpirdate = jQuery(this).val();
if(cardExpirdate == '' || cardExpirdate.length >=7) {
jQuery('.cardExpirdate').hide();
} else {
jQuery('.cardExpirdate').show();
}
});
 /* Card expiry date format end*/


Responsive jQuery window width

var windowWidth = jQuery(window).width();
if(windowWidth < 1000 ) {
}



Comments

Popular posts from this blog

TypeScrpt basics

font-face HTTPS issue fixes