AttachEvent for characters left

  •  03-10-2014, 1:26 PM

    AttachEvent for characters left

    We have a client that wants a "characters left" countdown from a maxlength so we've created one with editor.attachEvent.  Buttons for this editor are very basic:  undo, redo, cut, copy, paste.  The following attached event function works great in IE but in Firefox and Chrome, the undo/redo buttons don't trigger the event.  Can anyone help with this?

     

    function CE_attachEvent() { 

    var editor1 = document.getElementById('<%= Editor4.ClientID %>');

    if (editor1 != null) { 

    var editdoc = editor1.GetDocument();

     

    if (editor1.attachEvent)

    editor1.attachEvent('onclick', UpdatePlainTextCount);

    else if (editdoc.addEventListener)

    editor1.addEventListener('onclick',UpdatePlainTextCount,true); 

     

    if (editor1.attachEvent)

    editor1.attachEvent('onkeyup', UpdatePlainTextCount);

    else if (editdoc.addEventListener)

    editor1.addEventListener('onkeyup',UpdatePlainTextCount,true);

     

     Thanks!

     
View Complete Thread