This article is a mirror article of machine translation, please click here to jump to the original article.

View: 12569|Reply: 2

[Jquery] jQuery list only allows one active check

[Copy link]
Posted on 12/17/2018 2:12:39 PM | | | |
The original effect, if you choose between li nodes, you can ensure that the selected nodes can have an activated and selected state, but once you leave the entire ul list, all the selected activation states will disappear, which is not the effect I want, as shown in the figure below:

The code is as follows:

The above effect is not what I want, all I want is to move the mouse up,When the mouse is removed, there must always be a node activated and selected

The correct code is as follows:






As shown in the picture above, after I move the mouse, there is always a li node that is activated and selected.

When moving to the li node, first find the li sibling label and remove the class style. Next, use the end() method to end the reference to the li tag, which returns the current li node (jQuery object), and then add the style to the addClass() method later. In this way, I believe you have understood the end() method in jQuery.








Previous:SqlServer--delete, truncate, and Drop delete tables
Next:When the mouse moves to another layer inside the div, it triggers mouseout
Posted on 12/17/2018 2:28:55 PM |
Posted on 12/17/2018 4:33:54 PM |
The landlord knows everything
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com