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
29
votes
6 answers

jQuery .click function not working on < td > tag?

So I am creating a table using Javascript and jQuery, and I want it so that when you click the td's on the first row of the table, then the rest of the td's in that column drop down. Let me try to explain it by showing my code. Here is my…
SilentDev
  • 20,997
  • 28
  • 111
  • 214
24
votes
4 answers

jQuery .change() event is triggered with .click() in newer versions?

I'm currently upgrading my application to use jQuery 1.6.1 (previously using 1.4.4) and found that now the .click() event automatically triggers a .change() event as well. I created a simple example here: http://jsfiddle.net/wDKPN/ Notice if you…
Jared Cobb
  • 5,167
  • 3
  • 27
  • 36
17
votes
5 answers

jQuery dynamic input field focus

I want to add an input field dynamically to my page using the following jQuery: var inputNode = ""; $("div").append(inputNode); and after doing so, I want the…
Kumite
  • 173
  • 1
  • 1
  • 5
16
votes
1 answer

How do websites end up breaking middle-click functionality?

By default, middle-click will open a link in a new tab. Some sites end up breaking this functionality. Middle-click ends up being the same as left-click. Why does this happen? Is it because they program functionality for a click event, and…
John Bachir
  • 22,495
  • 29
  • 154
  • 227
12
votes
2 answers

jQuery click() event catch-all?

we're showing a box on the screen that I want to hide when the user clicks anywhere on the screen, including body, anchors, divs, buttons, etc... Is there a selector that can handle this for me? Or is it a case of $('body, a, div, input').click()?
DaveDev
  • 41,155
  • 72
  • 223
  • 385
9
votes
4 answers

Why doesn't click work on appended elements?

I would like to move some html elements from one container to another endlessly using jQuery append function but, the click event won't fire no more when I click on the element/s that have been appended. Based on some threads similar to mine I found…
user9349193413
  • 1,203
  • 2
  • 14
  • 26
9
votes
3 answers

jQuery Not Recognizing Classes Added to Page Dynamically

I am working on a project, where I'd like to add many elements of the same class to a page, and make all of these classes accessible to a $('selector').click(); event handler. What is happening though, is none of the dynamically added elements of…
8
votes
1 answer

Clicking anywhere on any page of site causes jquery .apply error, why?

I have a few e.stopPropagation() events going on to prevent clicks from bubbling up for certain elements. But now it seems that everytime I click on anything, besides those elements, on these pages, I am getting this error in the console: Uncaught…
Solomon Closson
  • 6,111
  • 14
  • 73
  • 115
8
votes
2 answers

Why doesn't Opera throw a click event when you partially mark text?

Given the following HTML:
Some text
And some JS which detects the click event with JQuery: $("div").click(function() { alert('click!'); }); If you select a portion of the text in the div, the click event will…
kvikshaug
  • 189
  • 11
7
votes
5 answers

Clicking disabled select element doesn't trigger click or mousedown events on it's parent

Disabled elements such as doesn't react to click event , I'm trying to wrap them in a
and listen to it's click event. Clicking a disabled triggers the click on it's container
, but I am having problem with…
6
votes
5 answers

How to make image/div smaller when LMB is being pressed?

So, I have an image in the middle of the page (where I want it to remain) and while I hold the LMB I want it to get a little bit smaller, then go back to its previous size when released. Below the code: $(document).ready(function() { …
SAndreeaM
  • 99
  • 4
6
votes
3 answers

jquery click event for a class starting with same initial name

I have multiple divs added dynamically. The class name is given as "result_"+id where the id is from database table.
Gaurab Dahal
saurab dahal
How can I write the click event so that…
GaurabDahal
  • 876
  • 6
  • 16
5
votes
2 answers

Animated image not moving during long Javascript method call

During a method that runs for 10 seconds to add some elements to the html, the animated gif don't move at all, giving the feel that the web page is stuck. Any way around this. Example code: $('#button).click(function() { …
mrjohn
  • 1,141
  • 2
  • 13
  • 21
5
votes
2 answers

HTML: Text in block-element; get exact position of click

I need to now where in a html block-element that contains only text a click happened:
This is some awesome text
I would like to get the position of the letter that was clicked. Limitation: it is not possible to add additional childs to…
Dennis Guse
  • 883
  • 10
  • 34
4
votes
1 answer

codemirror data cannot be serialized without the submit event?

I have this problem with codemirror which is quite tricky and I have no idea how to get around to it. The data from codemirror just won't be serialized without the submit event - that's what I found out so far - like this…
Run
  • 54,938
  • 169
  • 450
  • 748
1
2 3
15 16