Timothy Coetzee Timothy Coetzee - 1 month ago 6
Javascript Question

Hide element on checkbox click/check, re-insert element on checkbox uncheck

Im learning Jquery so please bear with me here I would like to hide / remove a

DIVs
content if a checkbox is check>

When checkbox is unchecked I would like the
DIVs
content to re-appear
,(which was hidden on checkbox checked.)

I have managed to solve part 1 of the problem, hiding the content but Im stuck on getting content re-appear.

YOU CAN VIEW MY JSFIDDLE HERE

Any help appreciated

Answer
$(function() {
    $('.return_to_pickup_location').click(function() { //fire when the button is clicked
        $('form input:checkbox').each(function() {
          var checkbox = $(this);  
          if(checkbox.is(':checked')) 
             $('.returnLocation').hide("slow");
          else
            $('.returnLocation').show("slow");

        });
    });
});

Just add show to the element in else block.