Get text field value in mouse event

I would like to get the value from the text box when I right click> paste .

$('#searchbox').bind('paste', function (e) {
    alert($('#searchbox').val());
});

this code did not complete my solution.

+3
source share
1 answer

Try

$('#searchbox').bind('paste', function (e) {
    setTimeout(getTextValue, 10);
});

function getTextValue() {
    alert($('#searchbox').val());
}
+6
source

Source: https://habr.com/ru/post/1784026/


All Articles