Thanks to the help of another member I have successfully implemented a JS method that has the ability to paste excel data and split it into an HTML textbox table form (see thread).
The issue that I am now faced with is that this is only functional in Chrome, while IE10 and IE11 both flag the following error:
"Unable to get property 'getData' of undefined or null reference."
This error is thrown in the 2nd line of the function (below):
function (event) {
var input_id = $(this).attr("id");
var value = event.originalEvent.clipboardData.getData('text/plain'); //ERROR in IE
/* ... */
event.preventDefault(); // prevent the original paste
}
Wondering if anyone can see the issue at hand with why Chrome is satisfied while IE is not.
Answer found here: Intercept paste event in Javascript
This worked for me.
if (window.clipboardData && window.clipboardData.getData) { // IE
pastedText = window.clipboardData.getData('Text');
}
else if (event.originalEvent.clipboardData && event.originalEvent.clipboardData.getData) { // other browsers
pastedText = event.originalEvent.clipboardData.getData('text/plain');
}
In IE, it should be:
var value = event.originalEvent.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