All Questions

641
votes
22answers
683753 views

jQuery Event Keypress: Which key was pressed?

With jQuery, how do I find out which key was pressed when I bind to the keypress event? $('#searchbox input').bind('keypress', function(e) {}); I want to trigger a submit when ENTER is pressed. [U...
308
votes
10answers
161445 views

Use of the JavaScript 'bind' method

What is the use of bind() in JavaScript?
24
votes
4answers
24315 views

Why does click event handler fire immediately upon page load?

I playing around with a function that I want to bind to all the links. At the present the function fires when the page loads, instead of when I click on the link. Here's my code. (I can past in the ...
112
votes
9answers
193508 views

jQuery how to bind onclick event to dynamically added HTML element

I want to bind an onclick event to an element I insert dynamically with jQuery But It never runs the binded function. I'd be happy if you can point out why this example is not working and how I can g...
170
votes
7answers
59216 views

What's the difference between `on` and `live` or `bind`?

In jQuery v1.7 a new method, on was added. From the documentation: ‘The .on() method attaches event handlers to the currently selected set of elements in the jQuery object. As of jQuery 1.7, th...
4
votes
4answers
553 views

When you pass 'this' as an argument

I'm trying to learn about this, and it's confusing me a bit here: var randomFunction = function(callback) { var data = 10; callback(data); }; var obj = { initialData: 20, sumData: f...
133
votes
10answers
137319 views

Update Angular model after setting input value with jQuery

I have this simple scenario: Input element which value is changed by jQuery's val() method. I am trying to update the angular model with the value that jQuery set. I tried to write a simple direct...
12
votes
4answers
24604 views

How to bind mysqli bind_param arguments dynamically in PHP?

I have been learning to use prepared and bound statements for my sql queries, and I have come out with this so far, it works ok but it is not dynamic at all when comes to multiple parameters or when t...
89
votes
4answers
33220 views

Python: Bind an Unbound Method?

In Python, is there a way to bind an unbound method without calling it? I am writing a wxPython program, and for a certain class I decided it'd be nice to group the data of all of my buttons together...
51
votes
4answers
34008 views

.live() vs .bind()

I want to know the main difference between .live() vs. .bind() methods in jQuery.

Previous Next