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
Release: 2016-05-16 15:52:42
Original
1298 people have browsed it

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");
});

Copy after login

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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template