When user paste the text in the text box, the "onpaste"=doPaste() event handler works fine in IE10, but not working in Firefox.
Code: e=event
function doPaste(e) {
maxLength = 500;
value = document.getElementById("<%=txtTitle.ClientID%>").value;
if (maxLength) {
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
var oTR = document.selection.createRange();
var iInsertLength = maxLength - value.length + oTR.text.length;
var sData = window.clipboardData.getData("Text").substr(0, iInsertLength);
oTR.text = sData;
}
}
I am missing anything..or is there cross browser fix for this?