tags:

views:

33

answers:

1

Hello friends,

  $('#filedset').find("select, input, textarea").change(function() {
                alert($(this).val());
            });

if I use this code when I change anything on my dropdownlistbox I am getting alert but when I change anything on my Input or textarea changed text i am getting on alert?

is that something i am doing wrong?

thanks

+1  A: 

The change events for these fire when they lose focus normally (e.g. click outside), if you want the handler to execute as you type, I recommend using the .keyup() event instead (so you get the right value, keydown would be the value without the current key taken into account).

Like this:

$('#filedset').find('select, input, textarea').bind('change keyup', function() {
   alert($(this).val());
});

Or if you have lots of and/or dynamic elements, you can use .delegate(), like this:

$('#filedset').delegate('select, input, textarea','change keyup', function() {
   alert($(this).val());
});
Nick Craver
This is not working for me I am not getting alert with any value change
@rockers - Here's a short demo: http://jsfiddle.net/6X5d5/1/ Are you sure your selector is right, did you mean `$("fieldset")`, looking for `<fieldset>`, or are you actually looking for `id="filedset"`?
Nick Craver
awesome its worked for me..