Wrap highlighted text within textarea with strong tags using javascript/jquery -
i looking create javascript/jquery function wrap piece of highlighted text textarea in strong tags - similar wysiwyg editor here.
is possible , if can point me in right direction.
edit:
ok here's clearer description of want...
i have textbox on page can type in.
i want able highlight part of text , wrap highlighted part in <strong>
tags
so if text box had words one 2 three
, highlighted word "two", want able wrap word in strong tags - becoming one <strong>two</strong> three
hope clearer... know there plugins out there don't need full wysiwyg functionality.
my rangy inputs (terrible name, know) jquery plug-in this.
example code:
$("#foo").surroundselectedtext("<strong>", "</strong>");
jsfiddle: http://jsfiddle.net/agjda/
Comments
Post a Comment