I tried it ([jsfiddle](https://jsfiddle.net/qfwzfamd/2/)), but it's not working. 

How can you see the alert is empty. It's like .val() function starts before the string is copied.

```
$(document).on('paste', '#pasteIt', function(){
    alert($("#pasteIt").val());
    var withoutSpaces = $("#pasteIt").val();
    withoutSpaces = withoutSpaces.replace(/\s+/g, '');
    $("#pasteIt").text(withoutSpaces);
});

```

Why?