Jquery event handling Bind,Live,Delegates

Jquery event handling Bind,Live,Delegates

Jquery evevts  used to copy from some <div>,<a>,<p> tags values append to same as another Bind Live Delegate using this 3 methods

                                        DEMO






 Syntax:

$('#Jquery').delegate('selector','event',function()

 {

});


           HTML CODING

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Jquery event handling Bind,Live,Delegates</title>

    <script type="text/javascript" src="jquery-1.7.1.js"></script>
    <script type="text/javascript">
        $(function () {

            $("#Jquery p").bind("click", function () {

                $(this).clone().appendTo("#Label1");
           })

        });
       
        $(function ()
        {
            $("#Jquery a").live("click", function ()
            {
             
                $(this).clone().appendTo("#Label1");

            })
        });

        $(function ()
        {
            $("#Jquery").delegate("h1", "click", function ()
            {
               
                $(this).clone().appendTo("#Label1");

            });
        });

    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div align="center">
    <div id="Jquery">
                <asp:Label ID="Label1" runat="server" Text=""></asp:Label>

        <h1>Dot</h1><br />
         <p>Net</p><br />
        <a>Drizzles</a><br />
        <a href="#">blogspot.in</a></div>
    </div>
    </form>
</body>
</html>


Add - New Webform - add jquery 1.7.1.js plugin  - next add jquery div id and <a> and<p> append to label






Next - Add delegate  <h1> tag select text append to label control 





0 comments:

Post a Comment