【发布时间】:2015-08-07 04:42:56
【问题描述】:
我正在电话间隙中制作聊天应用程序,并且我想插入明喻,我已从文本区域插入明喻并显示在正文中,但问题是当我单击明喻时文本区域显示的是整个路径,而不是标题,比如我们写的笑:D,它显示了笑的明喻。当我点击笑时,它会显示图像的整个路径,但不会显示:D(我想要的)。这是我的代码:
<textarea name="txtmessage" style=" width: 82%; height: auto; outline-color: none;" id="txtmessage" placeholder="write your text here..."></textarea>
<div class="em">
<img src="http://simpleicon.com/wp-content/uploads/big-smile-256x256.png" width="25" id="showhide_emobox" />
<div id="emobox">
<img alt=":)" border="0" src="emotions/emoticon-happy.png" />
<img alt=":(" border="0" src="emotions/emoticon-unhappy.png" />
<img alt=":o" border="0" src="emotions/emoticon-surprised.png" />
</div>
</div>
$('#emobox img').live("click",function () {
var smiley = $(this).attr('alt');
var test = $(this).attr('src');
var tst1 = '<img alt=' + smiley + ' border=0 src=' + test + ' />'
ins2pos(tst1, 'txtmessage');
});
【问题讨论】:
标签: javascript jquery cordova