Popular Posts
Build an OpenVPN server on android device Preparation An android device, in this case, Sony xperia Z is used Root permission required Linux Deploy for deploy i... Enable SSL connection for Jsoup import org.jsoup.Connection; import org.jsoup.Jsoup; import javax.net.ssl.*; import java.io.IOException; import java.security.KeyManagement... Change the AppDomain's Base Directory and Environment Directory // Update AppDomain's Base Directory string root_path = "c:\\temp\\"; AppDomain.CurrentDomain.SetData("APPBASE", roo...
Stats
jQuery delegate
<html>
<head>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script type="text/javascript">
    $(function(){
        // add row button
        $('.append_button').click(function(){
            var row = $('<div class="lister">'+new Date()+'&nbsp;&nbsp;&nbsp;<input type="button" class="row_button" value="click me!" /></div>');
            row.appendTo('.container');
        });
        
        // delegate for append button
        $('.container').delegate('.lister input:button', 'click', function(){
            alert('delegate ok!');
        });
        // delegate for append button (falied, because .lister was not found on delegate action)
        $('.container .lister').delegate('input:button', 'click', function(){
            alert('delegate, again!');
        });
    });
</script>
</head>
<body>
<div class="container">
    <input type="button" class="append_button" value="Add" />
</div>
</body>
</html>