jquery elements by class
Posted
by tom
on Stack Overflow
See other posts from Stack Overflow
or by tom
Published on 2010-05-05T22:51:44Z
Indexed on
2010/05/05
22:58 UTC
Read the original article
Hit count: 171
jQuery
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');
}
});
});
© Stack Overflow or respective owner