我有微笑和满足div的div:
<div id="smiles">
<img src="/img/smile/acute.gif">
<img src="/img/smile/aggressive.gif">
<img src="/img/smile/bad.gif">
<img src="/img/smile/biggrin.gif">
<img src="/img/smile/blum1.gif">
<img src="/img/smile/blush.gif">
<img src="/img/smile/boredom.gif">
<img src="/img/smile/bye.gif">
<img src="/img/smile/clapping.gif">
<img src="/img/smile/congratulate.gif">
<img src="/img/smile/cool.gif">
<img src="/img/smile/cray.gif">
<img src="/img/smile/dance.gif">
<img src="/img/smile/dance2.gif">
</div>
<div contenteditable="false" unselectable="true" style="disabled:true" id="message_text">
<img src="/img/smile/boredom.gif">
</div>
和jQuery代码:
$("#smiles").on('click', 'img', function () {
if ($('#message_text').prop("contentEditable")) {
$('#message_text').append($(this).clone()).focus();
}
});
我也在尝试
if ($('#message_text').attr("contentEditable"))
如果div是contentEditable但IF
不起作用
答案 0 :(得分:1)
$("#smiles img").click(function(){
if ($('#message_text').attr("contentEditable")=="false")
{
$('#message_text').append($(this));
}
});