How are we doing? Please help us improve Stack Overflow. Take our short survey

Questions tagged [click]

In user interfaces, click refers to the depressing of a mouse button or similar input device.

Filter by
Sorted by
Tagged with
2707
votes
88answers
1.4m views

How do I detect a click outside an element?

I have some HTML menus, which I show completely when a user clicks on the head of these menus. I would like to hide these elements when the user clicks outside the menus' area. Is something like this ...
1108
votes
12answers
882k views

How to create a checkbox with a clickable label?

How can I create an HTML checkbox with a label that is clickable (this means that clicking on the label turns the checkbox on/off)?
570
votes
12answers
383k views

Difference between .on('click') vs .click()

Is there any difference between the following code? $('#whatever').on('click', function() { /* your code here */ }); and $('#whatever').click(function() { /* your code here */ });
325
votes
26answers
380k views

jQuery click events firing multiple times

I'm attempting to write a video poker game in Javascript as a way of getting the basics of it down, and I've run into a problem where the jQuery click event handlers are firing multiple times. They'...
272
votes
12answers
748k views

How to trigger a click on a link using jQuery

I have a link: <ul id="titleee" class="gallery"> <li> <a href="#inline" rel="prettyPhoto">Talent</a> </li> </ul> and I am trying to trigger it by using: $...
206
votes
36answers
408k views

How to bind 'touchstart' and 'click' events but not respond to both?

I'm working on a mobile web site that has to work on a variety of devices. The one's giving me a headache at the moment are BlackBerry. We need to support both keyboard clicks as well as touch events....
191
votes
12answers
445k views

How do I programmatically click a link with javascript?

Is there a way to click on a link on my page using JavaScript?
175
votes
11answers
446k views

Can I call jQuery's click() to follow an <a> link if I haven't bound an event handler to it with bind or click already?

I have a timer in my JavaScript which needs to emulate clicking a link to go to another page once the time elapses. To do this I'm using jQuery's click() function. I have used $().trigger() and window....
175
votes
9answers
167k views

HTML "overlay" which allows clicks to fall through to elements behind it [duplicate]

I'm trying to overlay a element on top of a webpage (to draw arbitrary graphics), and I've come to the point where I can stack it inside of a element on top of everything, but this prevents the user ...
160
votes
8answers
59k views

An error occurred: @Output not initialized

I'm working on an angular app for managers to keep track of their teams, and I'm stuck with an @Output error : An error occurred: @Output deleteMeeting not initialized in 'MeetingItemComponent'. I ...
143
votes
12answers
479k views

How to make a whole 'div' clickable in html and css without JavaScript? [duplicate]

I want to make it so that a whole div is clickable and links to another page when clicked without JavaScript and with valid code/markup. If I have this which is what I want the result to do - <a ...
141
votes
9answers
238k views

How to handle ListView click in Android

How do I listen to click event on a ListView? This is what I have now ListView list = (ListView)findViewById(R.id.ListView01); ... list.setAdapter(adapter); When I do the following list....
139
votes
5answers
78k views

jQuery: fire click() before blur() event

I have an input field, where I try to make autocomplete suggestion. Code looks like <input type="text" id="myinput"> <div id="myresults"></div> On input's blur() event I want to ...
128
votes
11answers
281k views

Play sound on button click android

How do I get a button to play a sound from raw when click? I just created a button with id button1, but whatever code I write, all is wrong. import android.media.MediaPlayer; public class ...
127
votes
5answers
139k views

How to remove all click event handlers using jQuery?

I'm having a problem. Basically, when a user clicks an 'Edit' link on a page, the following Jquery code runs: $("#saveBtn").click(function () { saveQuestion(id); }); By doing this, the onClick ...
123
votes
9answers
358k views

Why is this jQuery click function not working?

Code: <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script> <script type="text/javascript"> $("#clicker").click(function () { alert("...
113
votes
3answers
77k views

Can I click a button programmatically for a predefined intent?

I need the button click of the intent ACTION_SEND. Here there is no need of displaying UI. Can I get the "Send" button click from the MMS-SMSProvider in Android?
113
votes
4answers
84k views

How can I check if a key is pressed during the click event with jQuery?

I would like to catch a click event with jQuery and be able to tell if a key was pressed at the same time so I can fork within the callback function based on the keypress event. For example: $("...
111
votes
7answers
147k views

open a url on click of ok button in android

I have to open a URL on Click of OK Button in a view. Can someone tell how to do this?
110
votes
8answers
155k views

$(document).click() not working correctly on iPhone. jquery [duplicate]

This function works perfectly on IE, Firefox and Chrome but when on the iPhone, it will only work when clicking on a <img>. Clicking on the page (anywhere but on a img) wont fire the event. $(...
109
votes
5answers
104k views

Is there an equivalent to e.PageX position for 'touchstart' event as there is for click event?

I'm trying to get the X position with jQuery of a touchstart event, used with the live function? I.e. $('#box').live('touchstart', function(e) { var xPos = e.PageX; } ); Now, this does work with '...
107
votes
7answers
322k views

python selenium click on button

I am quite new to python selenium and I am trying to click on a button which has the following html structure: <div class="b_div"> <div class="button c_button s_button" onclick="...
99
votes
5answers
205k views

Get clicked element using jQuery on event?

I'm using the following code to detect when a dynamically generated button is clicked. $(document).on("click",".appDetails", function () { alert("test"); }); Normally, if you just did $('....
93
votes
6answers
125k views

jQuery click anywhere in the page except on 1 div

How can I trigger a function when I click anywhere on my page except on one div (id=menu_content) ?
93
votes
13answers
264k views

jQuery, checkboxes and .is(":checked")

When I bind a function to a checkbox element like: $("#myCheckbox").click( function() { alert($(this).is(":checked")); }); The checkbox changes its checked attribute before the event is ...
91
votes
6answers
146k views

How to stop default link click behavior with jQuery

I have a link on a web page. When a user clicks it, a widget on the page should update. However, I am doing something, because the default functionality (navigating to a different page) occurs ...
90
votes
6answers
413k views

$(document).on("click"... not working?

Is there a well-known mistake I could be making here? I've got a script that's using .on() because an element is dynamically generated, and it isn't working. Just to test it out, I replaced the ...
86
votes
6answers
311k views

How to trigger click event on href element

I'm trying to trigger click event on hyperlink with jQuery like the way below. Hyperlink does not have any id but it does have css class: $(document).ready(function () { $('.cssbuttongo').trigger('...
85
votes
10answers
99k views

Custom UITableViewCell selection style?

When I click on my UITableViewCell, the background part (the areas that my background image doesn't cover) turns blue when I click on the cell. Also, all of the UILabels on the cell turn to white when ...
83
votes
15answers
157k views

jQuery Button.click() event is triggered twice

I have the following problem with this code: <button id="delete">Remove items</button> $("#delete").button({ icons: { primary: 'ui-icon-trash' } }).click(function()...
82
votes
11answers
84k views

PhantomJS; click an element

How do I click an element in PhantomJS? page.evaluate(function() { document.getElementById('idButtonSpan').click(); }); This gives me an error "undefined is not a function..." If I instead ...
80
votes
4answers
97k views

jquery click doesn't work on ajax generated content

I am using $(".button").on("click", function(){ }); to click to a button which is on a container but then an ajax call is done and the content gets updated with new stuff and then when i try to ...
77
votes
8answers
234k views

Simulate a click on 'a' element using javascript/jquery

I am trying to simulate a click on on an element. HTML for the same is as follows <a id="gift-close" href="javascript:void(0)" class="cart-mask-close p-abs" onclick="_gaq.push(['_trackEvent','...
76
votes
6answers
464k views

Use jQuery click to handle anchor onClick()

I have a set of dynamically generated anchor tags in a for loop as follows: <div id = "solTitle"> <a href = "#" id = "' + tagId + '" onClick = "openSolution();"> ' + solTitle + '</a&...
74
votes
6answers
80k views

jQuery bind click *ANYTHING* but *ELEMENT*

Say there are some elements floating around, and I'm trying to do some when I click ANYTHING(divs, body, whatever...) but the one specified (e.g. div#special). I'm wondering if there's a better way ...
70
votes
3answers
109k views

jQuery click events not working in iOS [duplicate]

Second update: Looks like one of my functions (resetFigures) was preventing the event handler, so moving that to the end of the bind function sorted it out. Update: I realized after some basic testing ...
64
votes
8answers
35k views

Android: Disable highlighting in GridView

How can I turn off the orange highlight when clicking an item in a GridView? I haven't been able to find a solution in the documentation or through testing.
63
votes
4answers
94k views

Add parameter to Button click event

I have a wpf button like this: <Button Click="button1_Click" Height="23" Margin="0,0,5,0" Name="button1" Width="75">Initiate</Button> And I want to pass {Binding Code} passed as ...
59
votes
9answers
121k views

Using jQuery to programmatically click an <a> link

I know this question has been asked before, but after a search on the web I can't seem to find a straight forward answer. the HTML <a id=myAnchor href=index.php> the jQuery (Both of these do ...
58
votes
10answers
67k views

Javafx 2 click and double click

I would like to know if it was possible to detect the double-click in JavaFX 2 ? and how ? I would like to make different event between a click and a double click. Thanks
53
votes
5answers
32k views

jQuery .on() method doesn't see new elements

I'm getting a JSON element and building a list from its items like this: getTitles: function(data) { data = data || {}; var list = []; $.getJSON( '/titles', data, ...
53
votes
5answers
46k views

JavaScript touchend versus click dilemma

I am working on some javascript UI, and using a lot of touch events like 'touchend' for improved response on touch devices. However, there are some logical issues which are bugging me ... I have seen ...
52
votes
5answers
29k views

Programmatical click on <a>-tag not working in Firefox

I have a problem with the click()-function from jquery. I create a <a>-element with document.createElement('a') and want call the click()-function about this element. About this element, I want ...
50
votes
9answers
230k views

CSS Animation onClick

How can I get a CSS Animation to play with a JavaScript onClick? I currently have: .classname { -webkit-animation-name: cssAnimation; -webkit-animation-duration:3s; -webkit-animation-iteration-...
49
votes
2answers
95k views

How can I simulate a mouse click at a certain position on the screen?

What I want to do is to manipulate the mouse. It will be a simple macro for my own purposes. So it will move my mouse to certain position on the screen and click like I am clicking with certain ...
48
votes
5answers
36k views

Prevent event bubbling in Vue

<div id="largeArea" v-on:click="do_X"> <button>Button</button> </div> So I have this issue in Vue where I don't want "do_X" to trigger when I click on the button, although ...
46
votes
5answers
34k views

Need to cancel click/mouseup events when double-click event detected

How is this done?
44
votes
8answers
141k views

Combine hover and click functions (jQuery)?

Can hover and click functions be combined into one, so for example: click: $('#target').click(function() { // common operation }); hover: $('#target').hover(function () { // common operation ...
44
votes
15answers
37k views

jQuery click off element event

I have a floating div that gets displayed, and I want it to be hidden when the user clicks off the div. This would be similar to the .hover() function callback when hovering off an element. Only I ...
44
votes
24answers
42k views

Android - ListView - performItemClick

I'm facing some difficults when I try to use the performItemClick funcion of the ListView. All I want to do is to perform a click programatically in the first item of the list. How can I do that? I ...

1
2 3 4 5
180