5.1 jQuery基础

1. jquery.com 下载

    api.jQuery.com 查看api  important!!!

 

2. 绑定事件

    http://api.jquery.com/category/events/

  bind():attach a handler to an event, As of jQuery 1.7, the .on() method is the preferred method for attaching event handlers to a document

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>jQuery</title>
    <script src="jquery-2.1.3.min.js"></script>
    <script src="myJs.js"></script>
</head>
<body>
    <button id="btn">Click</button>
</body>
</html>
/**
 * Created by Administrator on 2015/2/18.
 */
$(document).ready(function () {
    $("#btn").on("click",clickhandler1);
    $("#btn").on("click",clickhandler2);
    $("#btn").off("click",clickhandler1);
});

function clickhandler1(e){
    console.log("clickhandler1");
}
function clickhandler2(e){
    console.log("clickhandler2");
}

  技术分享

 

3.

 

  

  

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。