if i have an Reactjs input text element with onPaste event assigned to it, how could I get the pasted value in the response?
at the moment what i get in the console is a SyntheticClipboardEvent with all properties as null. I read that the console.log is a async checker so thats why the majority of values are null as they are looking ahead.
However I am wondering how to get the value.
Cheers
To add the click event in React using plain JavaScript, you need to use addEventListener() to assign the click event to an element. Create one <button> element as ref props so that it can be accessed to trigger the click event.
onPaste: function(e) { console.log(e.clipboardData.getData('Text')); },
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With