Questions tagged [jquery-click-event]

The jQuery click event is a wrapper around the default browser "onclick" event.

The jQuery click event is basically a wrapper around the default browser "onclick" event. In jQuery, it provides the option to handle and trigger the mouse "onclick" event. The onclick event is being sent on an element when the mouse pointer is over that element, right after the mouse button is pressed and released.

Example

Binding click event handler

$("selector").click(function(){
  // do something
});
// Or
$("selector").on("click", function(){
  // do something
});

Reference

238 questions
0
votes
4 answers

jQuery - Button CSS Class Reset after 2 Clicks

On button first click, it should apply .btn-1 class, second click .btn-2 class and on Third click it should clear the .btn-1 and .btn-2 classes... Till here, I am able to achieve this. But If I click on the same button again, above functionality is…
Reddy
  • 1,477
  • 29
  • 79
0
votes
2 answers

Jquery function on specific window size

I'm trying to make a script only work when the user is in 1024 or less. It works somewhat okay, if the user don't resize the window. But when i fire the click event on lower than 1024 and then resize to lets say 1200 the toggle classes have been…
Mikkel Madsen
  • 347
  • 2
  • 5
  • 17
0
votes
1 answer

If statements ignoring variables inside click events

I'm new to jQuery, I'm trying to make something very simple. An if statement inside a click event. When I click a button, if the variable is = 1, something happens, if it is equals something else, something else happens. But it seems the click…
0
votes
4 answers

Group multiple AJAX success calls into one

I'm updating records in my database using a checkbox in a table. I'm trying to offer 1 Alert after ALL the updates went through, rather than alerting for each individual success call $('#update').click(function () { $('#view_26 tbody…
0
votes
2 answers

Can't use variable inside of click event?

I have this code and it's javaScript and jQuery: for (thisLooper = 1; thisLooper < 4; thisLooper++) { if ($("#writeComments"+thisLooper).length > 0) { $("#writeComments"+thisLooper+",#comments"+thisLooper+",…
Robin Cox
  • 1,470
  • 2
  • 16
  • 31
0
votes
3 answers

How style DIV when the id inclue strings in php?

How to use CSS or jQuery to style my background-color in DIV when the id inclue strings in php? My code is:
item
conan
  • 1,327
  • 1
  • 12
  • 27
0
votes
4 answers

How to "trigger" a click event on a specific anchor element with Javascript? preferably with jQuery

What I want to do is issue a click event, preferably with jQuery, on an anchor element, causing the browser to follow that link. I know that my anchor selectors are correct, as they are returning 1 from .length. Here's what I've…
Alex
  • 64,178
  • 48
  • 151
  • 180
0
votes
5 answers

Hiding one element when the other is clicked x times

I'm trying to get the .alert parent container(#alerts) to hide only when the close(X) button is clicked 3 times but it closes on a single click. They're three alerts and the visible one closes at each click. If I take out the second function, the…
Sleek Geek
  • 4,638
  • 3
  • 27
  • 42
0
votes
1 answer

full calendar event click not working

I have updated my fullcalendar plugin to the version 2.2.3 and now the eventClick is not getting triggered. I am using the jquery version 1.7.2 and jquery ui 1.8.18. Below is how I am calling the fullcalendar: eventClick is not working, but the…
0
votes
1 answer

Click event handler not working prepend parsed html

I have a element parsed from html template and i want to add a click event to it, it seems not working. but when i add element like $('#formatMe').click(); Here click is working but when var formats =…
saikiran
  • 2,247
  • 5
  • 27
  • 42
0
votes
1 answer

How do I reset all events in the Backbone

I want to restart all JQuery events in Backbone. The problem is this: when you go to the particular view I have the following event: el: $('#content'), events : { 'click #stops-drop-down' : 'stopDropDown', }, stopDropDown:…
Krasimir
  • 1,806
  • 2
  • 18
  • 31
0
votes
2 answers

jQuery: Building a new row with .click

DEMO on jsFiddle http://jsfiddle.net/L48L88vm/3/ The current code only adds a cell when I need it to create a new row below "Attorney Review Received" to display the file chooser.
Attorney Review…
Iluvatar14
  • 699
  • 1
  • 5
  • 18
0
votes
2 answers

Sending extra variables with a jquery click event

I have a bunch of divs that when they are clicked I want to update some data that is associated with it. I have a click event registered with the div but I can't figure out how to pass the data into the click event handler along with it. I've looked…
Chase Roberts
  • 9,082
  • 13
  • 73
  • 131
0
votes
1 answer

Prevent the tag to fire, when clicking a child video element without affecting video controls

I have this gallery of photos and videos that is fetched from social networks via a hashtag search. And this is the HTML structure:
reuelab
  • 1,976
  • 1
  • 19
  • 28
0
votes
3 answers

How to get the clicked child list item only with jQuery?

I have a multi-level unordered list. I am trying to attach the click handler to the list item and when it's clicked, I am trying to add the class active to it, but when a sub list item is clicked, the click handler is being triggered for both sub…
Suthan Bala
  • 3,209
  • 5
  • 34
  • 59