## Jquery basis (a)

Jquery basis

## First, the concept: javaScript framework to simplify the development js

  Following Prototype has an excellent library js code (js framework)

  Design purpose: the Write the Do More Less which encapsulates our common js function code

  Optimization Ajax interaction animation html document operation event processing

  Js code that encapsulates it

## Second, Quick Start

  ## Step 1

## 1 Download Jquery

Currently three versions

    1.x compatible ie678 official BUG maintenance functions only as of 2016 no longer update update (currently with a lot)

2.x are not compatible ie678 few useful only official BUG maintenance functions are no longer updated 2016 only to stop updating update 5.20

3.x is not compatible ie678 only support a small number of browsers unless special requirements generally do not use the plug-in does not support the old  current official maintenance update

    jquery-xxx.js development version

    jquery-xxx-mini.js --- the production version of the program runs in the implementation of the program no small indentation load faster

  ## 2 Importing files into mini version of JQuery

  ## 3 Use

<head>
<script src="jquery.js"></script>
</head>

  Before use, we have to identify our file

  Of course here, there is a second program, we do not want to download the file, you can also directly access the CDN (content delivery network) refer to it as Google and Microsoft's servers have jquery

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js">

## three, Jquery basic grammar:

  ##jQuery 语法是为 HTML 元素的选取编制的,可以对元素执行某些操作。

  ##一、我们要使用它,是不是要先获得对象

  语法:id选择器:$("#id名");

    var d=$("#d1");

     类选择器:$(".类名");

     var v=$(".d3");

     标签:$("标签名");

    var f=$("div");

##四、JavaScript对象和Jquery对象之间的转换

  ​##1、 jQuery对象和js对象的区别

​     1 jquery 方便

​      2 二者对象的方法不通用

  ##2、​ 相互转换

    ​ jq----》js jq对象[索引] 或者jq对象.get(索引)

​     js----》jq $(js对象)

语法:Jquery对象转JavaScript对象

       var d=$("#d1");
        d[0];

  JavaScript对象转Jquery对象

      var d=document.getElementById("d1");
        $(d);

Guess you like

Origin www.cnblogs.com/liurui-bk517/p/11104530.html