Home >Web Front-end >JS Tutorial >js captures the paste event implementation code in the mouse right-click menu_javascript skills

js captures the paste event implementation code in the mouse right-click menu_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:38:461180browse

For example, how to capture the event after clicking "Paste" in the menu
js captures the paste event implementation code in the mouse right-click menu_javascript skills
Problem solved!
Using the paste event in jQuery, you need to pay attention here. If you want to get the pasted text, you need to use setTimeout Control your time.

Copy code The code is as follows:

$("#input").bind('paste ', function(e) {
var el = $(this);
setTimeout(function() {
var text = $(el).val();
alert(text);
}, 100);
});

It seems that this stuff was added after version 1.4.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn