jQuery mouse click counter

0 votes
I need to color a table in zebra style, and then when I click on the table, twice (not double click), it should change back to original.

My question is, how to count 2 clicks?
Jun 15 in JQuery by gaurav
• 17,000 points
67 views

1 answer to this question.

0 votes

You can use jQuery's toggleClass function for that:

$(" ... ").click(function() {
    $(this).toggleClass("someClass");
});

When clicked once, the element has the someClass class, and when clicked twice, the class is removed again.

answered Jun 16 by rajatha
• 7,040 points

Related Questions In JQuery

0 votes
1 answer

How to distinguish between left and right mouse click with jQuery

Using the mousedown() method: The mousedown() method in ...READ MORE

answered Jun 14 in JQuery by gaurav
• 17,000 points
26 views
0 votes
1 answer

How do I check if the mouse is over an element in jQuery?

Hello @kartik, Use this code: $("someelement").mouseenter(function(){ ...READ MORE

answered Oct 5, 2020 in JQuery by Niroj
• 82,740 points
953 views
0 votes
1 answer

How to Handle Button Click Events in jQuery?

jQuery click() Method The click event occurs when ...READ MORE

answered Jun 2 in JQuery by Edureka
• 13,640 points
26 views
0 votes
1 answer

How to trigger a click on a link using jQuery

If you are trying to trigger an ...READ MORE

answered Jun 3 in JQuery by Edureka
• 13,640 points
291 views
0 votes
0 answers

jQuery mouse click counter

I need to color a table in ...READ MORE

Aug 2 in Web Development by gaurav
• 17,000 points
5 views
0 votes
1 answer

What is jQuery?

Hey, jQuery is a fast and concise JavaScript ...READ MORE

answered Feb 14, 2020 in JQuery by kartik
• 37,500 points
306 views
0 votes
1 answer

Uncaught TypeError: Cannot read property 'msie' of undefined - jQuery tools

Hello, Use the following script tag in your ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,740 points
8,795 views
0 votes
1 answer

Uncaught Error: Bootstrap's JavaScript requires jQuery

Hello @kartik, You have provided wrong order for ...READ MORE

answered Apr 28, 2020 in JQuery by Niroj
• 82,740 points
15,768 views
0 votes
1 answer

How to trigger a click on a link using jQuery

$( "#foo" ). trigger( "click" ); As of jQuery ...READ MORE

answered Jun 10 in JQuery by rajatha
• 7,040 points
30 views
0 votes
1 answer

How to trigger a click on a link using jQuery

Use the jQuery click() Method You can use ...READ MORE

answered Jun 10 in JQuery by rajatha
• 7,040 points
26 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP