JQuery學習總結

來源:互聯網
上載者:User

標籤:bs   jquery   

What  is jQuery?         

         jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.

特點:     

       Write less,Do more

        jQeury is designed to change the way whta you write JavaScirpt;

       以強大的CSS選取器為基礎,幾乎所有操作都先使用選取器尋找DOM對象,然後對齊進行各種操作。

      屏蔽瀏覽器差異,對DOM的操作提供了方便的擴充,易用的事件處理API和動畫API.

使用方法:

在需要使用jQuery的頁面中引入jQuery的js檔案即可

<script type="text/javascript" src="js/jquery.js"></script>

jQuery對js開發四部分的完美實現

對於JS來說

1,、對於j尋找DOM元素進行取值和賦值的操作、在特定節點位置進行內容的取值和複製操作。

2、針對元素進行事件監聽。

3、通過操作DOM節點結合改變元素的CSS樣式,達到絢麗的動畫效果。

4、對DOM元素進行Ajax操作。

對於jQuery來說

1、jQuery擁有強大的選取器,可以尋找任意的DOM元素。同時jQuery對象實現鏈式文法,能夠很方便的寫出強大的操作。比如操作屬性:

     $("#chkbox").attr("checked","checked").attr("disabled","disabled").可以這樣繼續連結下去,包括增加事件、樣式等操作。

2、在頁面載入時給DOM綁定事件。$("chkbox").click(function(){alert("hello jquery");});

3、show()和hide()是jQuery中最基本的動畫。對元素顯示和隱藏,通過fadeOut和fadeIn可以實現淡出淡入的效果。

4、$.ajax(options)是jQuery中最底層的Ajax實現。還可以使用$.get()或$.post()實現Ajax請求。

待續。。。


JQuery學習總結

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.