How to implement click event on dynamically generating ?
Since you are running D6, you should look into the live() jQuery handler ( http://api.jquery.com/live/ ) that can be used to attach these click handlers to your dynamic elements.

More information on this can be found by googling or otherwise searching for

jquery click event on dynamically generated elements

You might also want to look into the Drupal.behaviors method of including jQuery and javascript instead of the $(document).ready() approach you've used.