jQuery click function issue

jQuery click function issue

I know this is caused by:

jQuery(document).click(function(){

but, when I try to replace this with anythiung else like:

jQuery(document).ready(function(){

for example, it no longer works. As far as i can remember the (document).click fucntion is there completely by accident and yet its needed for it to work properly, what am i missing?


  1. jQuery(document).click(function(){
  2.      jQuery('.toggle-on').click(function(){
  3.          jQuery('.post-info').addClass("post-info-toggle-off");
  4.          jQuery(this).addClass("toggle-off");
  5.          jQuery(this).removeClass("toggle-on");
  6.      });
  7.      jQuery('.toggle-off').click(function(){
  8.          jQuery('.post-info').removeClass("post-info-toggle-off");
  9.          jQuery(this).addClass("toggle-on");
  10.          jQuery(this).removeClass("toggle-off");
  11.      });
  12.      jQuery('.list-toggle').click(function(){
  13.          jQuery('.post-text').hide();
  14.          jQuery('.post-list').show();
  15.          jQuery('.info-toggle').addClass("toggle-off");
  16.          jQuery('.info-toggle').removeClass("toggle-on");
  17.      });
  18.      jQuery('.info-toggle').click(function(){
  19.          jQuery('.post-text').show();
  20.          jQuery('.post-list').hide();
  21.          jQuery('.list-toggle').addClass("toggle-off");
  22.          jQuery('.list-toggle').removeClass("toggle-on");
  23.      });
  24. });