All Questions

648
votes
22answers
691075 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...
320
votes
11answers
172711 views

Use of the JavaScript 'bind' method

What is the use of bind() in JavaScript?
24
votes
4answers
25633 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 ...
115
votes
9answers
196855 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...
4
votes
4answers
677 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...
136
votes
10answers
141656 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...
13
votes
4answers
24958 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...
90
votes
4answers
34023 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...
28
votes
4answers
4171 views

Why is JavaScript bind() necessary?

The problem in example 1 is 'this' referring to the global name instead of the myName object. I understand the use of bind() in setting the value of this to a specific object, so it solves the proble...
51
votes
4answers
34093 views

.live() vs .bind()

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

Previous Next