Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

Error when pasting text in IE #789

Closed
BKlerx opened this issue Mar 23, 2015 · 0 comments
Closed

Error when pasting text in IE #789

BKlerx opened this issue Mar 23, 2015 · 0 comments

Comments

@BKlerx
Copy link

BKlerx commented Mar 23, 2015

The code for the event handler that is called when pasting some text into the input control throws an error because 'e.originalEvent.clipboardData' is undefined in Internet Explorer.

I found a solution on http://stackoverflow.com/questions/27738155/unable-to-get-property-getdata-of-undefined-or-null-reference-in-ie-but-not

This code applies the fix and works fine for me:
_searchInput.on('paste', function (e) {
var data;
if (window.clipboardData && window.clipboardData.getData) { // IE
data = window.clipboardData.getData('Text');
}
else if (e.originalEvent.clipboardData && e.originalEvent.clipboardData.getData) { // other browsers
data = e.originalEvent.clipboardData.getData('text/plain');
}
...

I am using jQuery 2.1.3 and AngularJS 1.3.14

erikdubbelboer added a commit to atomx/ui-select that referenced this issue Oct 26, 2015
Add paste="expression" to allow custom paste handling.

Allow pasting in tagging mode when the tagging function is not defined.

In IE use window.clipboardData so jQuery is not required.

Fixes angular-ui#910, angular-ui#704, angular-ui#789, angular-ui#848, angular-ui#429
erikdubbelboer added a commit to atomx/ui-select that referenced this issue Oct 27, 2015
Add paste="expression" to allow custom paste handling.

Allow pasting in tagging mode when the tagging function is not defined.

In IE use window.clipboardData so jQuery is not required.

Fixes angular-ui#910, angular-ui#704, angular-ui#789, angular-ui#848, angular-ui#429
erikdubbelboer added a commit to atomx/ui-select that referenced this issue Nov 9, 2015
Add paste="expression" to allow custom paste handling.

Allow pasting in tagging mode when the tagging function is not defined.

In IE use window.clipboardData so jQuery is not required.

Fixes angular-ui#910, angular-ui#704, angular-ui#789, angular-ui#848, angular-ui#429
danielgrippi pushed a commit to viewthespace/ui-select that referenced this issue Jan 12, 2016
Add paste="expression" to allow custom paste handling.

Allow pasting in tagging mode when the tagging function is not defined.

In IE use window.clipboardData so jQuery is not required.

Fixes angular-ui#910, angular-ui#704, angular-ui#789, angular-ui#848, angular-ui#429

(cherry picked from commit 5b852b3)
aaronroberson added a commit that referenced this issue Feb 18, 2016
Add paste="expression" to allow custom paste handling.

Allow pasting in tagging mode when the tagging function is not defined.

In IE use window.clipboardData so jQuery is not required.

Fixes #910, #704, #789, #848, #429
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants