日期:2014-05-16  浏览次数:20350 次

jQuery JavaScript之插入表情后光标自动在表情字符的后

if(typeof document.selection !== "undefined"){//IE
???? $("#commentTextarea").focus();
???? document.selection.createRange().text = "insertText";
??? }else{
???? $("#commentTextarea").val($("#commentTextarea").val() + "insertText").focus();
??? }

就是这么简单!