Wednesday, 2 October 2013

Pasting text from clipboard to Firefox and Chrome

Pasting text from clipboard to Firefox and Chrome

I am using this function that pastes text from clipboard into multiple
text fields.
function pasteFromClipboard(className) {
var data = window.clipboardData.getData('Text');
if (data != null) {
var cells = data.split('\n');
var columns = $$('.'+className);
for (i = 0; i < cells.length; i++) {
if ( columns[i] != undefined ){
columns[i].value = cells[i];
}
}
}
}
This stuff that is attached to button via "onClick" works in IE, but not
in FF or Chrome. Now I know FF restricts access to clip, but I have
manipulated the values in preferences with no success.
Can anyone help me out with this functionality, so it would work in Chrome?
Best regards, no9

No comments:

Post a Comment