tags:

views:

25

answers:

2

I have some dropdownlist boxes in my field set if I change any field in the Fieldset I need to catch the value of changed dropdownlist?

Can I do this?

thanks

+1  A: 

The jquery selector should look something like this

$("fieldset#idOfSpecificFieldSet select")

you can then iterate though each select element like this

$("fieldset#idOfSpecificFieldSet select").each(function() {
   alert($(this).val());  //iterate though select elements and alert the value
});

as for attaching a button click you could do something like this

$(document).ready(function () {

  $(buttonselector).click(function() {
    $("fieldset#idOfSpecificFieldSet select").each(function() {
       alert($(this).val());  //iterate though select elements and alert the value
    });
  })

});
John Hartsock
+1  A: 

Try something like along these lines...

$('select').change(
   function(){
     $(this).val()
    }
);

You can change the selector to match all selects under your field set too...

Teja Kantamneni