1. jquery Knowledge Learning ...

Source: Internet
Author: User

1<! DOCTYPE html Public"-//w3c//dtd XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >234<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>5<title> Untitled Document </title>6<script src= "Jquery-1.11.2.min.js" ></script>7<style type= "Text/css" >8 #D19 {TenFont-size:24px; One } A.List - { -Width200px; theHeight30px; -Text-align:Center; -Line-height:30px; -Vertical-align:Middle; +Background-color:#999; -Color#F00; + } A</style> at -  -<body> -  -<div id= "D1" name= "div" ><b> first div</b></div> -  in<divclass= "D" >22222</div> -<divclass= "D" >333333</div> to<divclass= "D" >444444</div> +  -  the<divclass= "List" >hello</div> *<divclass= "List" >world</div> $<divclass= "List" >hai</div>Panax Notoginseng<divclass= "List" >aaaa</div> -  the  +<input type= "text" bs= "UID"/> A  the  +<input type= "checkbox" id= "AA" value= "Hello"/> -  $<input type= "button" id= ' btn ' value= ' take value '/> $  -  -</body> the<script type= "Text/javascript" > - Wuyi //JS takes the element, takes out the concrete element object the //var d = document.getElementById ("D1"); - //alert (Document.getelementsbyclassname ("D")); Wu //alert (document.getElementsByTagName ("div")); - //alert (Document.getelementsbyname ("UID")); About  $ //Operation content - //alert (D.innertext);//Get text content - //alert (d.innerhtml);//Get HTML code - //d.innertext = "Hello";//Assign value to Element (text) A //d.innerhtml = "<span style= ' color:red ' >hello</span>";//Assign value to element (HTML code) +  the //d.value Gets or sets the contents of a FORM element -  $ //Operation Properties the //alert (D.getattribute ("name"));//Gets the value of the property the //d.setattribute ("BS", "001");//Set Properties the //d.removeattribute ("name");//Remove attribute the  -  in //Operation style the //alert (d.style.fontsize);//Get style, must be written inside the element the //d.style.fontsize = "36px";//Modify Settings style About  the  the  the$ (document). Ready (function(e) { +      -     //jquery takes an element and takes out a jquery object the //var D = $ ("#d1");//Search by IDBayi     /*var d = $ (". D");//Search by Class the      the For (var i=0;i<d.length;i++) -     { - Alert (D.eq (i)); the     }*/ the      the     //Alert ($ ("div"));//Search by tag name the      - //alert ($ ("[Bs=uid]"));//Search by attribute the      the //Operation content the //alert (D.text ());//Gets the contents of the element (text)94 //alert (d.html ());//Gets the contents of the element (HTML code) the      the //d.text ("Hello");//Assigning a value to an element (text) the //d.html ("<span style= ' color:red ' >hello</span>"); Assigning a value to an element (HTML code)98      About //d.val ();//manipulate the contents of the form to assign values -     101     102 //Operation Properties103 //alert (d.attr ("name"));//Get Property104 //d.attr ("BS", "001");//Set Properties the //d.removeattr ("BS");//Remove Properties106     107 //Operation style108 //alert (D.css ("font-size"));//Sampling type109 //d.css ("Font-size", "36px");//Set style the     111      the //Events113 /*$ ("#d1"). Click (function () { the          the alert ("AA"); the         117         })*/118         119      - /*$ (". D"). Click (function () {121         122 //alert ($ (this). text ());123 124         })*/ the         126     //Menu Selection127$ (". List"). Click (function(){ -         129         //make all elements unchecked the$ (". List"). CSS ("Background-color", "#999"). CSS ("Color", "#F00");33s          the         //make the element selected133$ (this). CSS ("Background-color", "#60F"). CSS ("Color", "#FFF");134                 135         })136         137     //take checkbox Check value138$ ("#btn"). Click (function(){139          $         if($ ("#aa") [0].checked)141         {142Alert ($ ("#aa").Val ());143         }144         Else145         {146Alert ("Unchecked! ");147         }148         149     }) Max             151 }); the</body>153

1. jquery Knowledge Learning ...

Related Article

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.