search
HomeWeb Front-endJS TutorialUse jquery to change the background color of the click column_jquery

How to use jquery to click on one column to change color, and then click on another column to change color, but the original one changes back to its original color. I have an array a (1, 2, 3, and I loop through it to output the value of a.

Copy code The code is as follows:

Click 1,1 to change color, click 2,2 to change color, but 1 will change back to its original color. My show method implements other functions.
The following is my initial test code:
HTML code:
Copy code The code is as follows :


JScript code:


In the above code, the style 'clckClass' may be used on other elements. Using $('.clckClass').removeClass('clckClass'); will use clckClass on the screen. The style elements are moved out of the clckClass style. This is obviously not the result we want. We just need to remove the clckClass style under ul li a. However, I later discovered that the only thing in the above code is that clckClass can only be used in these tags. If it is also used in other tags, it may affect the effect. I was not thoughtful. I only considered that the clckClass style should only be used in these tags. Based on the above situation, you can make some small modifications, as follows:
JScript code:
Copy code Code As follows:



Writing this way will save the node with the clckClass class in a variable. The next time you click, you don’t need to traverse it again, and the speed will be faster.
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
谷歌浏览器背景色怎么改?谷歌浏览器背景色设置方法谷歌浏览器背景色怎么改?谷歌浏览器背景色设置方法Mar 13, 2024 pm 01:40 PM

  谷歌浏览器的背景是默认的,那么我们想要更换该怎么设置呢?谷歌浏览器是具有修改背景颜色功能的,但是很多新手伙伴不清楚如何修改,其实很简单,下面小编带来的谷歌浏览器修改背景颜色步骤方法,感兴趣的话一起来看看吧。  修改方法  1、首先打开Google浏览器,点击右上角的三点。  2、然后出现下拉框,点击设置。  3、接着点击自定义您的Chrome个人资料。  4、最后选择喜欢的颜色,浏览器的背景就会自动变色。

如何修改Win7文件夹的背景颜色如何修改Win7文件夹的背景颜色Jan 01, 2024 pm 10:11 PM

虽然使用了很长时间的电脑,但是很多朋友可能不知道,win7系统文件夹的背景色是可以更改的,我们可以选择自己喜欢的颜色成为文件夹的背景色,只需要替换相应的文件就可以了,下面一起来看一下吧。win7文件夹背景色更改教程1、首先我们进入“windows”文件夹。2、然后进入以下路径“C:\Windows\Resources\Themes\Aero\Shell\NormalColor”,找到“shellstyle.dll”文件,复制他,然后关注一下它的大小。3、接着新建一个文件夹,将它粘贴进去,备份好。

使用PyCharm调整背景颜色的方法使用PyCharm调整背景颜色的方法Feb 02, 2024 pm 06:33 PM

如何利用PyCharm调整背景颜色,需要具体代码示例导言:PyCharm是一种功能强大的Python集成开发环境(IDE),它提供了许多方便的功能来提高开发人员的效率。其中之一就是可以调整编辑器的背景颜色。本文将介绍如何使用PyCharm调整背景颜色,并给出具体的代码示例。正文:PyCharm提供了一个易于使用的界面,以允许用户自定义编辑器的外观和感觉。要调

记事本怎么设置背景? Win7设置记事本背景色的方法记事本怎么设置背景? Win7设置记事本背景色的方法Jun 11, 2024 pm 01:49 PM

最近有用户想要修改电脑记事本的背景颜色,但不清楚具体如何去修改,其实方法非常简单,本文将给大家带来Win7记事本背景颜色的修改方法。1、首先,打开控制面板界面,并点击进入其中的“外观和个性化”。2、接着,在打开的界面中,选择进入到“个性化”设置。3、然后,点击最下方的“窗口颜色”。4、随后,在弹出的窗口中,将“项目”选择为“窗口”,并设置所想要的颜色,点击确定即可。

如何在dedecms中增加新栏目?如何在dedecms中增加新栏目?Mar 14, 2024 pm 01:51 PM

如何在dedecms中增加新栏目?随着互联网的快速发展,网站内容管理系统变得越来越重要。而dedecms作为一款功能强大且灵活的内容管理系统,受到了许多网站开发者的青睐。在使用dedecms建站的过程中,有时候我们需要根据实际需求增加一些新的栏目,以便更好地组织和管理网站内容。那么,如何在dedecms中增加新栏目呢?接下来将为您介绍具体的操作步骤和代码示例

Dedecms删除栏目的步骤详解Dedecms删除栏目的步骤详解Mar 15, 2024 am 10:15 AM

在Dedecms中,删除栏目是网站管理中常见的操作之一。在进行删除栏目操作之前,需要谨慎对待,以免对网站造成不可逆的影响。下面将详细介绍在Dedecms中删除栏目的步骤,并提供具体的代码示例,帮助网站管理员顺利完成这一操作。首先来看一下在Dedecms中删除栏目的具体步骤:登录Dedecms后台管理系统,进入栏目管理页面。找到需要删除的栏目,点击栏目名称进入

Dedecms删除栏目的注意事项Dedecms删除栏目的注意事项Mar 14, 2024 pm 10:00 PM

在使用DedeCMS建站过程中,经常会遇到需要删除栏目的情况,而正确的删除栏目操作不仅要注意数据库一致性和数据完整性,还要确保网站正常访问不受影响。本文将介绍删除DedeCMS栏目的注意事项,同时附上具体的代码示例,帮助网站管理员正确地进行操作。首先,我们需要了解删除栏目涉及到的几个关键表:dede_arctype、dede_addonarticle、ded

如何在DedeCMS中修改栏目设置?如何在DedeCMS中修改栏目设置?Mar 14, 2024 pm 09:27 PM

在DedeCMS中,修改栏目设置是非常常见且重要的操作。栏目设置的修改涉及到网站的结构布局、推广效果和用户体验等方面。本文将介绍如何在DedeCMS中修改栏目设置,并提供具体的代码示例,帮助读者更好地理解和应用这一功能。DedeCMS是一款功能强大的内容管理系统,其灵活的模板系统和丰富的插件库为网站的定制提供了很大的便利。在DedeCMS中,栏目设置包括但不

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)