views:

42

answers:

2

Hello all,

I am trying to alert something when ever a drop down box changes and when ever something is typed into an input. I don't think I can use change for input fields? What would you use for input fields? Also, what about input fields of type file? Same thing. Here is what I have so far and its not working:

    $('input#wrapper, select#wrapper').change(function(){

        alert('You changed.');

    });

Thanks all

+1  A: 

You can bind a keypress event to the text box.

$("#wrappertext").bind("keypress", function(){
   // your code
});

In your sample you have used the same id for the text box and the select box. Change this also.

rahul
Sorry, I was trying to use multiple selectors where I tried to set the change event on all input elements and all select elements within the wrapper div. I made a mistake there.
Abs
You can use `input:text` and `select` and then pass `#wrapper` as the context.
rahul
Yeh, I am using `#wrapper select` now for the change event. What event would I use if user has browsed to a file location and selected it?
Abs
A: 

when ever something is typed into an input

change() happens in input type text happens when the value is change on blur...

try keyup() or keydown() instead.

Reigel