Home >Web Front-end >JS Tutorial >jquery implements a selector instance that does not contain the current item_jquery

jquery implements a selector instance that does not contain the current item_jquery

WBOY
WBOYOriginal
2016-05-16 15:52:421299browse

The example in this article describes the jquery implementation of a selector instance that does not contain the current item. Share it with everyone for your reference. The details are as follows:

This code demonstrates jquery selecting all links. When one of the links is clicked, the other links will change color, and only the current link will not change color

var $allLinks = $("a");
$allLinks.click(function() {
  $allLinks.not(this).css("color", "red");
});

Readers who are interested in more content related to jquery selector can check out the special topic of this site: "Summary of jquery selector usage"

I hope this article will be helpful to everyone’s jquery programming design.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn