Home > Web Front-end > JS Tutorial > Click on a certain text to change the text color_javascript skills

Click on a certain text to change the text color_javascript skills

WBOY
Release: 2016-05-16 16:45:56
Original
1412 people have browsed it

Instructions:

Click on a certain text to change the text to red. After clicking again, the text will turn back to black.

Copy code The code is as follows:




jquery test





Learning is like sailing against the current, if you don’t advance, you will retreat


Learning is like sailing against the current, if you don’t advance, you will retreat


Learning is like sailing against the current, if you don’t advance, you will retreat

/p>




Because this is a process of alternating classes, it can be used toggleClass method, if the corresponding class: "red" exists, remove it, if not, add it

Copy code The code is as follows:




jquery test





Learning is like sailing against the current, if you don’t advance, you will retreat


Learning is like sailing against the current, if you don’t advance, you will retreat

If you don’t advance, you will retreat


Learning is like sailing against the current, if you don’t advance, you will retreat




< ;/html>

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