javascript - Create a simple WYSIWYG web editor -
i'm new web development , i've never worked on web-related projects before, in scholar project thing, have create wysiwyg web editor scratch.
till i've learned html, css , javascipt , intent attack jquery , read source code of web editor (like tinymce) me going , have idea of have do. problem tinymce way complicated me, need web editor simpler that. if u me name grateful : )
my advise start building simple , small, not trying understand other editor code.
basically need textarea , bunch of buttons.
textarea difficoult format, should use editable div, allows formatting text:
<div id='fake_textarea' contenteditable></div> <input id="jbold" type="button" value="b">
then jquery magic, can 'boldify' selected text when clicking button. simplest way execcommand('bold')
method, finds selected text , makes bold:
$('#jbold').click(function () { document.execcommand('bold'); });
in fiddle can find basic example. can add other button, italic or underline.
Comments
Post a Comment