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

Error when pasting text in IE #789

@BKlerx

Description

@BKlerx

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions