how to get all Editable field values using jquery on button click
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...
精彩评论