Posts

Showing posts from November 16, 2013

Online Text Editor in Javascript

Image
here I have pic of my simply created online text editor, actually I was working on a project and it needs a form that also can edit text like making it Bold, Italic, underline and many things. So, In this smallest project I took Text area HTML DOM and few buttons as it is obvious in the above pic. When person on client side starts writing then simply he or she may need to decorate his or her writing since in database as we know that it will simply store like ordinary data and when we retrieve it it simply display it in string format. To make it decor able after saving we will have to add html tags like </br> to break line and <b></b> to make text bold. java script function code  function editor(domofhtml) {             var Field = document.getElementById('TextArea1');             var val = Field.value;             var selected_txt = val.substring(Field.selectionStart, Field.selectionEnd);             var before_txt = val.substring(0, Field.selectionSt