开发者

jquery elements by class

开发者 https://www.devze.com 2022-12-29 21:14 出处:网络
im trying to get all dropdown lists by class and change their names, my code is not working, is there something i am missing?

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).a开发者_Python百科ttr('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');
    }

});

});


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消