开发者

how to get all Editable field values using jquery on button click

开发者 https://www.devze.com 2023-01-03 19:36 出处:网络
I have some dro开发者_如何学Gopdownlist boxes in my field set if I change any field in the Fieldset I need to catch the value of changed dropdownlist?

I have some dro开发者_如何学Gopdownlist 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


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
    });
  })

});


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...

0

精彩评论

暂无评论...
验证码 换一张
取 消