javascript - Please tell me about the problem of emoji output on the WEB.
怪我咯
怪我咯 2017-06-30 09:56:01
0
1
786

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 = ['            
怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
伊谢尔伦

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');
    });
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!