Dynamically add, remove, find ways css property

Parents () method returns dom node ancestor elements, if added to the existing class property name in parentheses, brackets transfer the current element is returned;
- - - - - Dividing line- - - - - - - - - 
SIBLINGS () method to return all nodes dom sibling elements.
Example:

$(document).ready(function(){
$("li.star").siblings().css({"color":"red","border":"2px solid red"});
});

Blue-based part of the brackets, the ".star", will be understood as selected ".star", the upper and lower label

siblings (), brackets, can also write siblings ( '. arr'), which means to select a label attribute name arr

- - - - - Dividing line- - - - - - - - - 

removeClass () method , means to remove the class name of the tag
 
- - - - - Dividing line- - - - - - - - - 
 
toggleClass () method can be used to switch the attribute name tag

Guess you like

Origin www.cnblogs.com/yixiongqiang/p/12213071.html