How to fetch content on onpaste events in LWC?

830    Asked by CarolBower in Salesforce , Asked on Jul 23, 2021

When I am trying to fetch the data on onpaste event. checkPasteLength gets invoked when I try to paste some text but event.key returns undefined and event.clipboardData.getData('textarea') returns null

checkPasteLength(event){ console.log(event.key); console.log(event.clipboardData.getData('textarea')); }

Is there a way to get the value on onpaste


Answered by Bruce Benedict

This wilk works fine for fetch content on onpaste.

  checkPasteLength(e){ var clipboardData = e.clipboardData || window.clipboardData; console.log(clipboardData.getData('Text')); }


Your Answer

Interviews

Parent Categories