Micro-Bo imitation effect

$ (function () { 
        . $ (. "BTN") ON ( "the Click", function () { 
            var Li = $ ( "<Li> </ Li>"); 
            li.html ($ (. "TXT" ) .val () + "<a> delete </a>"); 
            . $ ( "ul") prepend (li); 
            $ ( "li") slideDown ();. 
        }) 
        $ ( "ul"). on ( "click", "a ", function () {// use the event delegation of ways to add events to the elements added later 
            $ (this) .parents ( "li "). slideUp (function () {// can hidden away on a slide and then let li delete 
                $ (the this) .remove ( "li"); 
            }); 
        }) 
    }) 

HTML: 

    <div class = "CON"> 
        <span> micro-Bo </ span>
        <input type="text" class="txt">
        <input type="button" value="发布" class="btn">
    </div>
    <ul>
    </ul>

  

Guess you like

Origin www.cnblogs.com/qtbb/p/11349754.html