MU Lesson jQuery 2018/6/21

Source: Internet
Author: User

Jquery Document: Api.jquery.com

Dom Objects and jquery objects

if (obj.nodetype)  //Detect DOM Object   return 1if (obj.jquery)        //Detect jquery Object   Ruturn jquery version 1.12.4 conversion var jqueryobj=$ (domobj);   $ () package var domobj=jqueryobj.get ([index]);   Get method
Create an HTML element:
var div=$ ("<div>hello</div>");  Create a $ () package for the Html.console.log (DIV);    Output Dom  Divconsole.log ($ ("div"));  The jquery selector is not available and the page is not visible. Div.appendto ("body");   Append to body last face. Console.log ($ ("div"));//The page appears, the jquery selector is selected.

Create/Add Property

var link1=$ (' <a> ', {      text: ' Baidu ',      href: ' http://www.baidu.com ',      target: ' _blank ',      title: ' goto Baidu '}); Link1.appendto (' body ');//The first method is suitable for empty elements. var link2=$ (' <a>baidu</a> '). attr ({      href: ' http://www.baidu.com ',      target: ' _blank ',      title: ' goto Baidu '); Link2.appendto (' body ');
The second use of attr ();

jquery operations

$ (). length; check element [index]   //Extract element, return Domget ([])   //Extract element, return Domget ()   //No index, return array object. Get ( -1)   //take from the last element.  -2,-3 backwards in turn. Undefined occurs across the border. eq (index)   Returns a JQuery object.   

First () //One
Last () //FINAL

The performance of the method is greater than the filter;

ToArray () returns the collection as if it were not a parameter.

  

 

 

MU Lesson jQuery 2018/6/21

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.