I have the following HTML:
<span class="edit" contenteditable="true">Some text goes here</span>
This span is editable so I can write in it in the browser.Now my question is, when I press the enter key while the cursor is inside this span,the class of this span should be changed from edit to add.Because there is some css for both of these classes. I know it can be done in jquery by using addClass.toggleClass etc. But I need this to be done in pure javascript as I am using it in TinyMCE editor.
So can anyone help me how it can be done in javascript?