Skip to content

Instantly share code, notes, and snippets.

View MSerj's full-sized avatar

Mitu Sergiu MSerj

View GitHub Profile
@MSerj
MSerj / onlyNumbers.js
Last active December 6, 2017 08:41
only numbers
//only-numbers
$(".only-numbers").on("keypress", function (evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;
return !(charCode > 31 && (charCode < 48 || charCode > 57));
});
@MSerj
MSerj / placeholder.js
Created October 30, 2017 19:22
hide placeholder on focus and return it on blur
$('input, textarea').focus(function(){
$(this).data('placeholder',$(this).attr('placeholder'));
$(this).attr('placeholder','');
});
$('input, textarea').blur(function(){
$(this).attr('placeholder',$(this).data('placeholder'));
});