0

I have this piece of code:

$(document).ready( function(){
$(".cb-enable").click(function(){
    $("#repetitive").show();
    var parent = $(this).parents('.switch');
    $('.cb-disable',parent).removeClass('selected');
    $(this).addClass('selected');
    $('.checkbox',parent).attr('checked', true);
    $("#repetitiveHidden").empty();
    $("#repetitiveHidden").val("true");
});
$(".cb-disable").click(function(){
    $("#repetitive").hide();
    var parent = $(this).parents('.switch');
    $('.cb-enable',parent).removeClass('selected');
    $(this).addClass('selected');
    $('.checkbox',parent).attr('checked', false);
    $("#repetitiveHidden").empty();
    $("#repetitiveHidden").val("false");
});
$(".overnight-enable").click(function(){
    var parent = $(this).parents('.switch');
    $('.overnight-disable',parent).removeClass('selected');
    $(this).addClass('selected');
    $('.checkbox',parent).attr('checked', true);
    $("#overnightHidden").empty();
    $("#overnightHidden").val("true");
});
$(".overnight-disable").click(function(){
    var parent = $(this).parents('.switch');
    $('.overnight-enable',parent).removeClass('selected');
    $(this).addClass('selected');
    $('.checkbox',parent).attr('checked', false);
    $("#overnightHidden").empty();
    $("#overnightHidden").val("false");
});
$(".rep-daily").click(function(){
    var parent = $(this).parents('.switch');
    $('.rep-weekly',parent).removeClass('selected');
    $(this).addClass('selected');
    $('.checkbox',parent).attr('checked', true);
    $("#reccurType").empty();
    $("#reccurType").val("true");
});
$(".rep-weekly").click(function(){
    var parent = $(this).parents('.switch');
    $('.rep-daily',parent).removeClass('selected');
    $(this).addClass('selected');
    $('.checkbox',parent).attr('checked', false);
    $("#reccurType").empty();
    $("#reccurType").val("false");
});
$(".rep-cycle").click(function(){
    var parent = $(this).parents('.switch');
    $('.rep-endDate',parent).removeClass('selected');
    $(this).addClass('selected');
    $('.checkbox',parent).attr('checked', true);
    $("#reccurWay").empty();
    $("#reccurWay").val("true");
    $("#endDate").hide();
    $("#cycle").show();
});
$(".rep-endDate").click(function(){
    var parent = $(this).parents('.switch');
    $('.rep-cycle',parent).removeClass('selected');
    $(this).addClass('selected');
    $('.checkbox',parent).attr('checked', false);
    $("#reccurWay").empty();
    $("#reccurWay").val("false");
    $("#cycle").hide();
    $("#endDate").show();
});

 })(jQuery);

At this line:

})(jQuery);

I have the error Uncaught TypeError: object is not a function Please help

3
  • 3
    Probably the best-ever excuse for needing a fast answer on SO. Commented Oct 23, 2013 at 17:51
  • @GalV he says the line in his question. Commented Oct 23, 2013 at 17:51
  • all code is in one line, try commenting/removing parts of your code to check where the error is... Commented Oct 23, 2013 at 17:52

1 Answer 1

3

Just remove this:

 })(jQuery);

to

 });

Because it's not an anonymous function you're calling, but the document ready, which does not need such direct call.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.