1. Events not seen:
The difference between Focusin and the focus event is that he can detect a child's focus on the parent element.
The difference between the Focusout and the Blur event is that he can detect when a child element loses focus on the parent element.
2. Using the Wrapall method
Examples are as follows
Original code:
<div class= "MM" ><p> we are in the company </p></div>
<div class= "MV" >
<p> we are in the company </p>
<p> we are in the company </p>
<p> we are in the company </p>
</div>
jquery Operation: $ ("P"). Wrapall (' <div class= ' test ' ></div> ');
Output code:
<div class= "MM" >
<div class= "Test" ><p> we are in the company </p>
<p> we are in the company </p>
<p> we are in the company </p>
<p> we are in the company </p>
</div>
</div>
<div class= "MV" >
</div>
Summarize:
This method moves all P tags to the position where the first P-label appears and appendto it to <div class= "test" ></div>
3, for the use of detach methods:
Description: The Remove () method removes all event handlers and other data that may be bound to the removed element. The detach () method and the Remove () NVC, but does not remove the event handlers and data. Detach may be more useful if you want to temporarily remove elements from the document so that they can be inserted again later.
Case:
HTML code:
<a class= "Clickelm" style= "display:block;width:100px;height:20px;line-height:20px;text-align:center; Background: #e1e1e1; " > Click me </a>
<a class= "clickElm2" style= "display:block;width:100px;height:20px;line-height:20px;text-align:center; Background: #e1e1e1; " > Click on my 2</a>
jquery Operations:
var $clickElm = $ (". Clickelm"),
$CLICKELM 2 = $ (". clickElm2")
;
$clickElm. attr ("PPP", "999");
$CLICKELM 2.attr ("PPP", "999");
$CLICKELM. Click (function () {
Alert ($ (this). attr ("PPP"));
});
$clickElm 2.click (function () {
Alert ($ (this). attr ("PPP"));
});
$clickElm. Detach ();
$CLICKELM 2.remove ();
SetTimeout (function () {
$clickElm. AppendTo ("body");
$CLICKELM 2.appendTo ("body");
},15000);
Results:
<a ppp= "999" class= "Clickelm" style= "display:block;width:100px;height:20px;line-height:20px;text-align:center; Background: #e1e1e1; " > Click me </a>
<a ppp= "999" class= "clickElm2" style= "Display:block;width:100px;height:20px;line-height:20px;text-align:center ; background: #e1e1e1; " > Click on my 2</a>
A tag with the class name "Clickelm" appears again after it disappears for 15 seconds, and can respond to a click event, and a label with the class name "ClickElm2" appears again after 15 seconds, but cannot respond to the Click event, and the value given by the attr function is still present in the element
jquery Learning Document Notes