jquery implements a selector instance that does not contain the current item
- 2020-06-19 09:48:08
- OfStack
This article is an example of an jquery implementation with a selector instance that does not contain the current item. Share to everybody for everybody reference. The details are as follows:
This code demonstrates that jquery selects all of the links, and when you click on one of the links, all other links change color, except for the current link
var $allLinks = $("a");
$allLinks.click(function() {
$allLinks.not(this).css("color", "red");
});
For more information about jquery selectors, please see the jquery Selectors Summary
Hopefully, this article has helped you with your jquery programming.