I followed this question JavaScript get clipboard data on paste event (Cross browser) to get the pasted data from the clipboard, but I used jquery instead. Now that I got t
Might be easier to let the paste proceed and update element immediately after. Would depend on use case also as cursor position could be lost this way
$(':input').on('paste', function (e) {
var $el = $(this);
setTimeout(function () {
$el.val(function(){
return this.value.replace(/foo/g, "bar");
})
});
})
foo was here