I have an issue with the onpaste event in JS. I need to copy the clipboard content into 2 text boxes by splitting it into half. I am using the code below.
function paste(){
document.getElementById("txt1").value = clipboarddata.substr(0,2);
document.getElementById("txt2").value = clipboarddata.substr(2,4);
}
this function is called on the onpaste
event. The content gets pasted but after the function the entire string is again paste in the box into which the data was paste.
Can i by any chance cancel the event by using cancelbubble
etc to cancel the event in the paste() function. ??
Thanks in advance