I am making a web chat room application, and today I want to add the function of sending emoji. I encountered two problems while writing JS.
Question 1: When adding a click event to the traversed emoji image, you want to get the text content of the writing panel #write first. Use getElementById to get "", but you can use $("#write").val( )Get the previously written content;
Question 2: If you have written content before clicking the emoji, the emoji cannot be printed?
Code: (Sorry, it seems a bit uncomfortable to use JS and Jquery together)
function clickEmoj(){//Generate and destroy emoj
var emojs = ['
伊谢尔伦2017-06-30 09:58:01
My implementation logic is very simple
$('#emoji span').click(function(){
var val = $('.chat-active input[type=text]').val();
$('.chat-active input[type=text]').val(val+$(this).text());
$('#emoji').css('display','none');
});