jquery comment

jQuery API 1.4.4中文版chm下载

http://www.skygq.com/2011/01/01/jquery%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95%E6%80%BB%E7%BB%93/

$("#id").text("hello");

$("#id").html("<strong>hello</strong>");

$("#btn").click(function(){xxx});

$("#btn").click(xxx);

$("#btn").on("click",function(){xx});

<html>
    <button id="add">Add new</button>
    <div id="container">
        <button class="alert">alert!</button>
    </div>
</html>

<script>
$("button#add").click(function() {
    var html = "<button class='alert'>Alert!</button>";
    $("button.alert:last").parent().append(html);
});
</script>

with unbinding via

$("#element").off("click.someNamespace");

$("#whatever").trigger("click");

相关推荐