jquery small issue I need help with

Posted by Martin on Stack Overflow See other posts from Stack Overflow or by Martin
Published on 2010-05-20T23:23:24Z Indexed on 2010/05/20 23:30 UTC
Read the original article Hit count: 124

Filed under:

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');
            }

        });
    });

© Stack Overflow or respective owner

Related posts about jQuery