0

Im using a code tag which has its content-editable set to true. Its not triggering the change event which is attached to it on load. What are the list of all possible events that are triggered from it?

I have tried the input event listener. It catches the event. But places the cursor in the start after the handler is executed. Any fix for this?

Im using the highlightjs for highlighting something, which is within the code tag with the content-editable option set to true.

<div class="steps-cont"><pre><code class="steps full-width javascript" contenteditable="true"></code></pre></div>
//Callback:
$('code.steps').unbind("input").bind("input", function(){
  hljs.highlightBlock($('code.steps')[0]);
});
Shyam R
  • 473
  • 1
  • 5
  • 17
  • Dupe of http://stackoverflow.com/questions/1391278/contenteditable-change-events? Despite the jQuery based question, the answer is still very much relevant. – evolutionxbox May 10 '17 at 11:34
  • Possible duplicate of [contenteditable change events](http://stackoverflow.com/questions/1391278/contenteditable-change-events) – evolutionxbox May 10 '17 at 11:34
  • ok, I have tried the input event listener, for that its listening, but then placing the cursor in the start of the element, which makes it to type in reverse – Shyam R May 10 '17 at 11:39
  • That sounds like your callback is doing something weird... can you edit your question with a [mcve]? Remember, no one else can see what you can. – evolutionxbox May 10 '17 at 11:40
  • What's the deal @ShyamSundarR? Are you alergic to code? Show us a [mcve] at the very least. – zer00ne May 10 '17 at 11:41
  • I have edited it – Shyam R May 10 '17 at 11:44

0 Answers0