Reputation: 11
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');
}
});
});
Upvotes: 1
Views: 118
Reputation: 1108702
Changing the name attribute of HTML input elements which are already tied to the DOM tree will not work in a particular webbrowser developed by a team in Redmond. It works in the other browsers though. It thus look like that you're using IE6 or IE7 to develop and test the stuff.
The only solution for this browser is to remove the element physically from the DOM, update it and then insert it back, or to create a new one and then replace the old one with it.
Upvotes: 1