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
4
votes
2 answers

Jquery create Double Click event on A Href

Guys is it possible to create double click event for the a href using jquery
Dead Programmer
  • 12,427
  • 23
  • 80
  • 112
4
votes
4 answers

jQuery focusOut except if

I simply want to hide a div, if a text box loses focus, unless, the user clicks in another certain div. If user clicks that particular div, then the focusout doesn't trigger the div.box being hidden. Below is code with my pseudocode commenting. Any…
James
  • 5,942
  • 15
  • 48
  • 72
4
votes
1 answer

What is wrong with my .click() event?

My problem is the .click event below. The 'nav' and '#closemenu' div hide as expected on document ready, but the click event won't work to save my life. Either I'm missing something embarrassingly small (which I hope is unlikely because I…
DanielNordby
  • 569
  • 2
  • 6
  • 20
4
votes
1 answer

Traversing through Nested List - jQuery

I'm currently doing some DOM traversal with jQuery, I'm trying to select each element one at a time in #treeList when button is clicked, but once it goes through the second list #innerList, it will select all elements in that list, and continue on…
SPeoples
  • 57
  • 10
4
votes
3 answers

How to set the global variable in click event?

$(document).ready(function() { var x = ""; $("#anyElement").click(function() { x = "test"; alert(x); }); alert(x); }); When first alert works, messagebox shows "test". when second alert works, messagebox shows "…
Ahmet
  • 314
  • 5
  • 15
4
votes
3 answers

hidden Input type='file' is not triggering when its parent div has been clicked

Sorry if you find this question repetitive, but I looked around, tried, failed, so need your help. one.html
the.big.lebowski
  • 279
  • 1
  • 3
  • 12
4
votes
3 answers

Attach JQuery Click Event to Anchor Id

I have an easy one SO. Why cant I attach a click event straight to an anchors Id? I should have pointed out that I am also using JQuery Mobile.
Jon Wells
  • 4,191
  • 9
  • 40
  • 69
3
votes
1 answer

Toggled and animated anchor links do not navigate anymore

I am using jQuery.toggle and .animate for a navigation menu that sits at the bottom of the page. The nav consists of two divs, one as a outer container and the other as a inner container that holds the nav buttons etc. What I am trying to achieve…
jsavage980
  • 125
  • 2
  • 4
  • 17
3
votes
2 answers

I want to set my checkbox on "checked" when i click a specific td in my table

Hei guys. I want my Checkbox to be "checked" after i click the last td field of a row. I tried it with JQuery but unfortunately i always checked all checkboxes. I just want to check the td at the row i clicked. Thats how i build my table.
Elfdow
  • 77
  • 6
3
votes
5 answers

binding to click event - event only fires once

I'm using jquery to paginate an HTML table. I have 2 CSS classes, aPage and thePage, a javascript function that creates a pagination string, and jquery code to bind each "page" to the click event so that the pagination string is calculated when the…
Tac
  • 177
  • 3
  • 6
3
votes
2 answers

JQuery click anywhere except certain divs and issues with dynamically added html

I want this webpage to highlight certain elements when you click on one of them, but if you click anywhere else on the page, then all of these elements should no longer be highlighted. I accomplished this task by the following, and it works just…
jCuga
  • 1,523
  • 3
  • 16
  • 28
3
votes
1 answer

Table tr and td have weird click events

I have a table like the following snippet shows. $(function(){ $('.table-price td.go-to-price').click(function(){ console.log($(this).attr('data-link')); goToLink($(this).attr('data-link')); }) $('.table-price…
S.M_Emamian
  • 17,005
  • 37
  • 135
  • 254
3
votes
2 answers

jQuery programatically click a tag that has javascript:void(0)

I am trying to programmatically click the "zoom in" icon three times on a page. The is structured:   I have the following code, called on document…
troyrmeyer
  • 125
  • 1
  • 10
3
votes
4 answers

jQuery click event works only after second click

I've click event bind to a class called ".reportfile" as follow. $('body').on('click','.reportfile',function(e){ e.preventDefault(); e.stopPropagation(); var id=$(this).attr('id'); if(!$(this).hasClass('brc')) { // Perform…
Alok Patel
  • 7,842
  • 5
  • 31
  • 47
3
votes
3 answers

jQuery click on li with nested ul

I have a list within lists. When a user clicks on a list item (
  • ), I want the nested
      to show up. Before I started adding the nested lists, I just had it where clicking a list item would run a function. Now, clicking any of the nested lists…
  • hookedonwinter
    • 12,436
    • 19
    • 61
    • 74
    1
    2
    3
    15 16