$("p").css("color","red").addClass("hehe")
This is a very Ordinary chain operations, changing colors, and adding a style "class".
It feels like the chain operation can only be for yourself, but it is not the case.
$(".ti").click( function( ){ $(this).css("color","red").next(".pcontent").css("display","block"); } )
This chain operation does 2 things for two different elements.
Clicking on the element whose className is ti will add a class pcon to itself, and then set the display of the element whose class value is pcontent to block.
Note that if you want to operate other elements, you must add the keyword next, otherwise an error will be reported, and next will tell jquery that you want to operate other elements. elements.
And hover in css, a:hover b { color: red }, this is a typical hover a element and then give the b element Writing to increase the effect.
It’s really not easy for these two, they always think about others.
The above is the detailed content of The relationship between chain operations and hover in jquery - a detailed explanation of the next keyword. For more information, please follow other related articles on the PHP Chinese website!