//appendTo(): Append all matching elements to another, specified element set, that is, add sub-nodes //append(): Add sub-nodes to an element
7, demo7:--The table changes color every other row, the mouse slides over the color, and the color changes when clicked. Code explanation: I have already put the explanation in the example, so I will not post comments here. The examples used are: mouseover(), addClass(), mouseout(), removeClass(), click(), toggleClass(), tr:even and other methods. In addition, the difference between toggle() and toggleClass() is explained. In addition, in this example, I used chain operation. You can view the explanation in chain operation.txt.
8, demo8:--toggle() usage: $("p").toggle()//Switch the visible state of the element, but please note that this affects all p, You can also switch between two methods toggle( Function even, Function odd ).
9, demo9: --hover() usage: Hover(function over, function out)//Imitate hover events $("#orderedlist tr").hover(function over ,function out ) //Add
10,demo10:-- $ to all rows of a table. You can also use jQuery instead of $(document).ready(function(){// Your Code});//You can also use jQuery instead of $ jQuery(document).ready(function(){ jQuery(".").click(function(){jQuery(this).toggleClass ("")}) });//The advantage is that you may use other js libraries that also use $, which may conflict. jQuery instead of $ is a safer way of writing.
11, demo11:--each—Usage of find $("#orderedlist").find("li").each(function(i) { }) //find("li") finds all li elements, and each() executes the method on each object in the collection //each(Function function fn) to match each The element is used as a context to execute a function
12, demo12:--parents() usage: $(this).parents("p").addClass("highlight");// The nearest label this.parent()//refers to the parent node of the object
13, demo13:--Usage of load(): $("#feeds") .load("FAQ1.html",function() { alert("load is done");}
//From the remote one Load HTML from the file and inject it into the DOM
14, demo14: --next usage: .next()//Get the next sibling node of the object
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn