jquery Sina Weibo Emoticons plugin tutorial

Source: Internet
Author: User

1. Introduction of CSS Files

<rel= "stylesheet"  type= "text/css"  href= " Jquery.sinaEmotion.css ">

2. Introduction of Jquery.js and JQuery.sinaEmotion.js

<src= "Jquery.min.js"></script><  src = "jquery.sinaEmotion.js" ></script >   

3. HTML code

<formclass= "Publish">        <DivID= "Result"></Div>        <textareaclass= "Content"ID= "Content">Welcome to use jquery Sina emotion[hehe]</textarea><BR>        <inputclass= "Face"type= "button"value= "expression">        <inputclass= "Submit"type= "button"value= "Parse">    </form>

which

<id= "Result"></div>

is used to show the parsed expression.

<class= "Content"  id= "Content"> Welcome to jquery Sina emotion[hehe]</textarea>

TextArea used to display the text field that sends emoticons (you can also use input type= "text")

One thing to note is that the Text field or text box that displays the expression needs to be in the same form as the Send emoticons button. Because in JQuery.sinaEmotion.js, the expression is displayed by locating the textarea or input in the form form where the target is located.

function (target) {        = target                function() {                    return $ (this). Parents (' form '). Find (                            ' textarea,input[type=text] '). EQ (0);                };

Next, you add a click event by binding the ". Face" class name to the emoticon button.

$ ('. Submit '). Bind ({            function() {                var content = $ (' #content '). Val () ;                $ (' #result '). HTML (content). Parseemotion ();            }        );        $ ('. Face '). Bind ({            function(event) {                if(! $ (' # Sinaemotion '). Is (': Visible ')} {                    $ (this). Sinaemotion ();                    Event.stoppropagation ();                }            }    

Demo Address:

Http://pan.baidu.com/s/1bnnr1tt

jquery Sina Weibo emoticons plugin tutorial

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.