2
I was trying to do a validation but with the .on('input') it works better than the .on('Paste') (I needed to put a timeout to make it work), can anyone explain to me the difference between the two? Follow my code to illustrate the question:
Paste
$(this).on("paste", "#email", function(event) {
var $obj = $(this);
setTimeout(function() {
var str = $obj.val();
$obj.val(str.replace(/[^a-za-uA-ZA-U0-9_@\.\'\b\t]/g, ''));
}, 2);
});
input
$(this).on("input", "#email", function(event) {
var $obj = $(this);
var str = $obj.val();
$obj.val(str.replace(/[^a-za-uA-ZA-U0-9_@\.\'\b\t]/g, ''));
});
change
$(this).on("change", "#email", function(event) {
var $obj = $(this);
var str = $obj.val();
$obj.val(str.replace(/[^a-za-uA-ZA-U0-9_@\.\'\b\t]/g, ''));
});
Who gave the
-1
I invite you to motivate to realize what may be wrong in my reply.– Sergio