0

I have the following code.

function radioButtons() {

var _inputCount;
var _inputParentCount;
var _radioInput;

return {

    inputCounter:function(groupId){

        _inputCount = $(groupId).find("input");
        _inputParentCount = $(_inputCount).parent();

        for(i = 0; i < _inputParentCount.length; i++){
            $(_inputParentCount[i]).attr("id", groupId + [i]);
        }

    },

    radioAction:function(radioButton){

        _radioInput = $(radioButton).find("input");

        for(i = 0; i < _inputCount.length; i ++){

            $(_inputCount[i]).parent().removeClass("selected");
            $(_inputCount[i]).attr("value", "false");

        }


        $(radioButton).addClass("selected");
        $(_radioInput).attr("value", "true");
    },



};
};

var radioButtonsOne = new radioButtons();

$(document).ready(function(){
radioButtonsOne.inputCounter("#radioButtonsGroup");
});

Its a custom function I wrote for custom Radio buttons. I have a similar one for Checkboxes buttons. It works perfectly in all browsers except for IE7. It tells me that radioButtonsOne is not defined. But it is though. Any idea why?

Thank!

MaxArt
  • 22,200
  • 10
  • 82
  • 81
Gezzasa
  • 1,443
  • 8
  • 17
  • 1
    See http://stackoverflow.com/questions/5139205/javascript-can-a-comma-occur-after-the-last-set-of-values-in-an-array – simon Sep 13 '12 at 14:44

1 Answers1

5

change

  $(radioButton).addClass("selected");
        $(_radioInput).attr("value", "true");
    },

remove the ,

  $(radioButton).addClass("selected");
        $(_radioInput).attr("value", "true");
    }
karthikr
  • 97,368
  • 26
  • 197
  • 188
  • Nice! In fact, IE7 throws an exception when the last key of an object is followed by a comma. – MaxArt Sep 13 '12 at 14:41