jquery small issue I need help with
- by Martin
Hi I need help with a bit of jquery, I am renaming dropdown lists when a checkbox next to them is clicked. I want to get the selected option value of the dropdown called 'Prev' in the code below and assign to the checkbox that is clicked. I hope it makes sense. Thanks
$('.mutuallyexclusive').live("click", function() {
checkedState = $(this).attr('checked');
$('.mutuallyexclusive:checked').each(function() {
$(this).attr('checked', false);
$(this).attr('name', 'chk');
});
$(this).attr('checked', checkedState);
if (checkedState) {
jQuery('#myForm select[name=cat.parent_id]').attr('name', 'bar')
// here is the bit i need help with
var prev = $(this).prev('select').attr("name", 'cat.parent_id');
}
else {
var prev = $(this).prev('select').attr("name", 'dd');
}
});
});