1. Steps to use Jquery:(1) Import js library<script src="js/jquery-1.11.3.min.js"></script> //js/jquery-1.11.3.min.js compressed version (recommended) //js/jquery-1.11.3.js full version (2) Page loading event$(document).ready(function(){ Business operations; }); //After optimization: $(function(){ Business operations; }); 2. Conversion between Jq objects and js objects(1) js object----->jq objectvar js object = document.getElementById("id attribute value"); var $jq object = $(js object) (2) jq object----->js objectvar js object = $jq object.get(index); 3.jq's basic selector//(1)jq's id selector$("#id attribute value"). Binding event method (function(){ Business operations; }); //(2)jq's class selector$("#.class attribute value"). Binding event method (function(){ Business operations; }); //(3) Form selector$("Selected input tag [tag with specified attributes]"). Binding event method (function(){ Business operations; }); //(4)element selector$("element/tag").html("XXX"); 4.jq's hierarchical selector//Descendant selector $("parent tag child tag") //Child element selector $("parent element > child element") 5. Filter Selector$("label:first") // matches the first label $("label:even") // matches even number of labels starting from 0 (0,2,4...) $("label:odd") //matches odd number of elements starting from 1 (1,3,5...) 6. Attribute Selectors[attribute] //Matches elements with the current given attribute [attribute=value] //Matches elements with a given attribute that is a certain value [attribute!=value] //Matches all elements that do not contain the specified element's attribute, or whose attribute is not equal to a specific value [attribute^=value] //Matches specific elements that start with the specified element [attribute$=value] //Matches elements that end with the specified element [attribute*=value] //Matches elements with given attributes that contain certain values [selector1][selector2]...[selectorN] //Meets the attribute selector. Elements that meet multiple attribute conditions at the same time 7.jq document processing//Append append(content) //Append content to each matching element (recommended) jq object.appendTo(comtent) //Append the matched content to another specified element set //Prepend prepend(content) //Put each matching element in front of content prependTo(content) //Prepend all matching elements to another specified set of elements //insertafter(content|fn) //Insert content after each matching elementinsertAfter(content) //Insert the matched elements after contentbefore(content) //Insert content before each matching elementinsetBefore(content) //Insert each matching element before content SummarizeThis article ends here. I hope it can be helpful to you. I also hope you can pay more attention to more content on 123WORDPRESS.COM! You may also be interested in:
|
<<: New settings for text and fonts in CSS3
>>: Detailed explanation of the difference between tags and elements in HTML
First delete mysql: sudo apt-get remove mysql-* T...
First, attach the code below the effect diagram &...
Note: nginx installed via brew Website root direc...
The following demonstration is based on MySQL ver...
1. Download mysql-5.7.17-winx64.zip; Link: https:...
Platform deployment 1. Install JDK step1. Downloa...
<br />Original address: http://andymao.com/a...
Table of contents 1. Database design 2. Front-end...
The Docker Hub we used earlier is provided by Doc...
Table of contents 1. Signal List 1.1. Real-time s...
Table of contents Class Component Functional Comp...
You may often see some HTML with data attributes. ...
The order in which the browser loads and renders H...
Without further ado, I will post the code for you...
Table of contents 1. Multiple .catch 2. Multiple ...