views:

48

answers:

2

Hello All, I'm not able to get the below code to work.

$("#grid_table td:nth-child(10) input").live("onchange",function () {
    alert("changed");
});

am I missing something here? Thanks.

Ravi

A: 

Have you tried this:

$("#grid_table td:nth-child(10) input").change(function () {
  alert("changed");
});

to make sure your selector is working properly?

Hooray Im Helping
Being a huge Futurama fan, I love syncing your avatar pic to your name, just great!
Quintin Robinson
Tried both the approaches, but its not working. But the selector is working fine as the following code is working $("#grid_table td:nth-child(10) input").live("blur",function () { alert("changed"); });
Ravi
@Ravi: sorry. @Quintin: Thanks! Glad you got the reference =D
Hooray Im Helping
+1  A: 

Try changing onchange to change..

$("#grid_table td:nth-child(10) input").live("change",function () {
    alert("changed");
});

If that doesn't work I would verify your selector is working correctly.

Quintin Robinson
selector is working fine as the following code is working $("#grid_table td:nth-child(10) input").live("blur",function () { alert("changed"); });
Ravi
@Ravi how are you expecting the `change` to fire.. are you manually typing something and leaving the field or are you entering something programatically; a value entered programatically will not fire the change event FYI, also on most browsers the `change` event isn't fired until the field is exited with a modified (or dirtied) value.
Quintin Robinson
I'm manually changing/entering the text and leaving the field. I basically want to know if the text has been changed or not.
Ravi