Skip to content

Instantly share code, notes, and snippets.

@rneto
rneto / iife.js
Last active May 21, 2021 04:26
Template literals test
(function() { var uno = '1'; console.log(`${uno}`);}).call()
@rneto
rneto / isName.js
Last active November 12, 2015 11:36
Enter only names (numbers and special chars not allowed) in an input using javascript, regular expression and jquery
$(".isName").on("keypress keyup blur",function (event) {
var val = $(this).val();
if (val.match(/[@ºª*+\/\\|$#%()=?¿!¡¬^¨<>\[\]{}\-_&`'´".,:\;·€&#\d]+/)) {
$(this).val($(this).val().replace(/[@ºª*+\/\\|$#%()=?¿!¡¬^¨<>\[\]{}\-_&`'´".,:\;·€&#\d]+/, ""));
}
if ((event.which >= 48 && event.which <= 57)) {
event.preventDefault();
}
});