admin管理员组文章数量:1317909
i was wondering how does on many websites when i add a smile on textarea appears image instead of ex. :)
, so i want to ask you how it is possible, i need a simple example...
for example i have :
<img class="smile" src="smiles/smile1.gif" alt=":)" onclick="add_smile(1);"/><br/>
<textarea></textarea>
so i want onclick of image (.smile) to be added image on textarea, then to be possible to insert some words after image, or just explain me how does it may be done ( is there an <div>
element or it is a <textarea>
or idk what it can be.. )
thanks
i was wondering how does on many websites when i add a smile on textarea appears image instead of ex. :)
, so i want to ask you how it is possible, i need a simple example...
for example i have :
<img class="smile" src="smiles/smile1.gif" alt=":)" onclick="add_smile(1);"/><br/>
<textarea></textarea>
so i want onclick of image (.smile) to be added image on textarea, then to be possible to insert some words after image, or just explain me how does it may be done ( is there an <div>
element or it is a <textarea>
or idk what it can be.. )
thanks
Share Improve this question edited Apr 9, 2011 at 19:39 Hussein 42.8k25 gold badges115 silver badges143 bronze badges asked Apr 9, 2011 at 19:27 JohnJohn 7,91017 gold badges67 silver badges96 bronze badges1 Answer
Reset to default 9What you are seesing on many sites is not a textarea. It's a div with contentEditable attribute which acts like a textarea. That's how wysiwyg editors are created.
<div contentEditable="true"> Type here. You can insert images too </div>
Check working example at http://jsfiddle/6bCRJ/
本文标签: javascriptcustom textarea with image inside Stack Overflow
版权声明:本文标题:javascript - custom textarea with image inside- Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742029271a2416136.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论