Home > Web Front-end > JS Tutorial > The program segment equivalent to toggleClass in jQuery and the direction of future learning_jquery

The program segment equivalent to toggleClass in jQuery and the direction of future learning_jquery

WBOY
Release: 2016-05-16 18:32:00
Original
986 people have browsed it

The following two paragraphs of jQuery are equivalent
1 Use toggleClass to implement the alternation of class values

Copy the code The code is as follows:

$("#in1").click(function(){
$("li").toggleClass("ok2");
})

2 Use js to judge the alternation of class values
Copy the code The code is as follows:

$ ("#in1").click(function(){
var ok=$("li:first").attr("class")
if (ok == "ok2"){
$("li").removeClass();
}else{
$("li").attr("class","ok2");
}
})

I started learning jQuery yesterday. js is a big problem in my front-end design technology, and I have never found a good way to learn it. Recently, I suddenly realized that I can learn jQuery. This thing is easier to learn. So the plan is to first acquire jQuery in a short period of time, and then advance to js. Through the understanding of js, I will participate in C#. In terms of tools, I will gradually move away from Adobe's Dreamweaver and turn to MS's Expression and Visual Studio. VS's support for jQuery is good. After learning C#, I plan to consider Blend. Since I have decided to join Microsoft, I must learn to use MS software to replace Adobe.

Learning content to be arranged
1 jQuery combined with JavaScript
2 Expression (Web, Design, Blend) combined with Visual Studio and C#
3 Review high school mathematics (sets, sequences, functions, trigonometry Functions, analytic geometry, binomial theorem, simple statistical derivatives)
4 Advanced Mathematics
5 Discrete Mathematics
6 Linear Algebra
7 Data Structures and Algorithms
8 Chinese Language and Literature
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