Curtis Harvey![]()
pasted event - fires when user paste event has completed
Listen for event on any input[type=text], input[type=password], textarea, or element with contenteditable set. Passing a boolean arg of true instructs the event to only fire if the paste changed the value of the element ('value' property for inputs and textareas, 'textContent' for other elements).
<script src="http://yui.yahooapis.com/3.2.0 PR1/build/yui/yui-min.js"></script>YUI({
//Last Gallery Build of this module
gallery: 'gallery-2010.08.11-20-39'
}).use('gallery-event-pasted', function(Y) {
var onPasted = function(evt) {
alert('pasted!\n\nwas: "' + evt.prevVal + '"\n\nnow: "' + evt.newVal + '"');
};
// fire when any text is pasted into textfield
Y.one('#mytextarea').on('pasted', onPasted);
// fire only if pasted text changed field's value
Y.one('#mytextarea2').on('pasted', onPasted, null, true);
});No forum posts for this module.
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info