jquery elements by class
- by tom
Hi there
im trying to get all dropdown lists by class and change their names, my code is not working, is there something i am missing?
$(document).ready(function () {
$('.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) {
var prev = $(this).prev('select').attr("name", 'cat.parent_id');
elements = $('select.selected');
elements.each(function () { $(this).attr("name", "bbb"); });
}
else {
var prev = $(this).prev('select').attr("name", 'dd');
}
});
});