javascript - Simple real time WYSYWIG editor for text box in Jquery -


i know not strictly programming question, think best website ask anyway, please dont down vote me:) anyway, trying create simple textbox editor allows change font colour , size. should visible in real time. far have created div updated in real time in jquery dont know best way rest. there out there can me. prefer not use of advanced wysiwyg editors because implementation difficult. or sensible solution? advice please?

var div = $('#mydiv')[0];  $('input').bind('keyup change', function() {     div.innerhtml = this.value; });  <form>text here:<input></form> 

this not you're looking wanted show jsfiddle made quickly

i hope gives idea of looking for.

<div id="mydiv"></div>  <select id="color">     <option></option>     <option>red</option>     <option>blue</option> </select> <select id="size">     <option></option>     <option>10px</option>     <option>20px</option> </select> <form>text here:<input></form> 

js here

var div = $('#mydiv')[0];  $('input').bind('keyup change', function() {     div.innerhtml = this.value; });  $('#color').change(function(){     var colorselected = $(this).val();     $('#mydiv').css('color',colorselected); }); $('#size').change(function(){     var sizeselected = $(this).val();     $('#mydiv').css('font-size',sizeselected ); }); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -