Linked Questions

10 votes
3 answers
15k views

Difference between `$(document).on("click", "a"` and `$("a").click(` [duplicate]

Can Anybody tell me what will be the difference between these two script,Am not a javascript/jquery expert. $(document).on("click", "a", function () { i = $(this).data("value"); alert(i) }) $...
Sreepathy Sp's user avatar
2 votes
3 answers
4k views

Is there a difference between .change() and .on("change")? [duplicate]

Is there any difference between : $('selector').change(function() {}); and $('selector').on("change", function() {}); And if there is, which one should I use in most cases?
L. Techer's user avatar
0 votes
2 answers
409 views

When to use on() and click() in jquery [duplicate]

What is the difference between using on() and click() in jquery.? For example:Both work the same way: $(".classname").click( function() { var toAdd = $('input[name=checkListItem]').val(); ...
poorvank's user avatar
  • 7,574
1 vote
1 answer
942 views

Difference between onclick() and .on('click',function())? [duplicate]

$(document).ready(function(){ // Add smooth scrolling $('.button').children().onclick(function(event) { // Make sure this.hash has a value before overriding default behavior if (this.hash ...
Lord Grim's user avatar
0 votes
3 answers
236 views

Whats the difference between using .on('click' and .click? [duplicate]

Possible Duplicate: Difference between .on('click') vs .click() When handling a click of a div whats the difference between using .on and .click : $('#myDiv').on('click' , function(...
blue-sky's user avatar
  • 53.4k
0 votes
2 answers
75 views

event propagation event binding [duplicate]

What is the different between:- $("#btn").click(handler); and $("#btn").on('click', handler); Both of the above will bind a handler to the element on click event. When to use which one?
Shubham's user avatar
  • 189
0 votes
1 answer
117 views

jQuery event-handlers [duplicate]

I have been searching around without finding an satisfying answer. What is the difference between the 2 following event-handlers. $('#div').on('click', function(){ //do something }); and $('#...
Nilzone-'s user avatar
  • 2,786
0 votes
2 answers
81 views

Unable to add css property to <td> element by clicking on it [duplicate]

I am trying to build a pixel marker webpage for a project. It is almost completed. I am facing a couple of problems: Unable to fill in the color, when a <td> tag is clicked. The wells that ...
Gaurav Thantry's user avatar
2 votes
0 answers
50 views

jQuery change icon on click [duplicate]

noob question here (beginner to JavaScript & jQuery). I am learning code via codecademy etc., and they are teaching to use the following: $('.projects-button').on('click', function() { $('....
HJW's user avatar
  • 1,032
0 votes
0 answers
32 views

when do we need a selector with jquery on click [duplicate]

Hi Editor: this is not a question about: .on('click') vs .click HTML: <div id="menu"> <div id="someID"> <a href="#">click</a> </div> </div> ...
SIDU's user avatar
  • 2,278
624 votes
16 answers
1.1m views

Passing data to a bootstrap modal

I've got a couple of hyperlinks that each have an ID attached. When I click on this link, I want to open a modal ( http://twitter.github.com/bootstrap/javascript.html#modals ), and pass this ID to the ...
Leon Cullens's user avatar
  • 12.4k
47 votes
4 answers
49k views

How to unbind a specific event handler

Code: $('#Inputfield').keyup(function(e) { if(e.which == 13) { functionXyz(); } else { ...
MeProtozoan's user avatar
  • 1,027
7 votes
4 answers
28k views

jQuery hide() animation slide right

Using jQuery's hide() function with the optional duration parameter I'm able to get some alert boxes on my site to gracefully slide off screen and disappear. It appears that the default direction for ...
Michael Benjamin's user avatar
14 votes
3 answers
28k views

.change() vs .on( "change", handler ) in jQuery

I have an issue when I use jQuery to handle the trigger of change on my drop-down. I use 2 pieces of code: //---------- Case 1 $(document).on("change", "#drop-down-id", function () { alert(this....
haitran's user avatar
  • 735
4 votes
3 answers
29k views

How can I add onclick events to Wordpress Menus

I'm trying to add an onclick event to a WordPress menu that uses a nav walker. While I understand code and php I'm not very experienced with the WordPress system nor would I could myself an ...
byronjt's user avatar
  • 63

15 30 50 per page
1
2 3 4 5
9