dropdown and event handler binding.

dropdown and event handler binding.


Hi,

i am trying to make a dependable dropdown using ajax and jquery..   I'm trying to do it in the following way...

  1. url = 'topics.php?sectionid='+ $('#section').val();
            $('#topics').load(url).show();
            $('#topic').bind('change', function(event) {
                                                   topicChangeHandler();
                                                   });



The dropdown is coming but the onchange event handler is not getting attached. But if I use an alert before attaching the event handler, everything works fine.
  1. url = 'topics.php?sectionid='+ $('#section').val();
            $('#topics').load(url).show();
            window.alert('');
            $('#topic').bind('change', function(event) {
                                                   topicChangeHandler();
                                                   });




Here 'topics' is the id of the dive to which i'm adding the dropdown.. and 'topic' is the id of the dropdown.

Can anyone tell wht is wrong here... I'm pretty new to jQuery. Thanks in advance..

Robert