Hi Matt and John The code I provided was just a demo to show how things are arranged. The actual code is free of error as I checked with firebug. It seems the trouble is with what Matt is sujesting that $(document).ready wont work with ajax load. I am not sure what might be the best solution.
I will try to narrate the actual scenario. I have a list of buttons on my home page. When a user clicks on one of the button, it loads a list (select > option). Any selection made on the list loads another div (again using ajax) and I use jquery to load the second div. This all works as expected in Firefox but as soon as I try to get it working on IE7, it fails. I tried debugging and found that the second $(document).ready (loaded with ajax load) never got fired. In some other post, few have suggested using callback function. Can someone provide me a example of that. Is there a way to call $(document).ready after ajax load. Regards, Ritesh Matt Stith wrote: > > $(document).ready wont work in pages loaded via AJAX, try something like > this: > > <script...> document.ready(... > $('button').click( > $('#load_div').load(..some url.,function(response) { > //..whatever you need to be done after the load > }); > }); > </script> > > > On 2/11/07, Ritesh Agrawal <[EMAIL PROTECTED]> wrote: >> >> Hi, >> >> I am new to JQuery. I have tried few ajax features of jquery and they all >> work beautifully on firefox. But when I try them on IE7, they fail. The >> problem is with ajax and jquery. I load a div using ajax "load" function. >> The contents of the div also include some new jquery script to controller >> the behaviour of new dom elements. However, the document.ready() never >> gets fired up after the ajax div is loaded. >> >> here is example of what I am saying >> Origial Page >> <head> >> <script...> >> document.ready(... >> $('button').click( >> $('#load_div').load(..some url.); >> }); >> </script> >> </head> >> <body> >> ..... >> <div id='load_div'></div> >> </body> >> >> After Ajax >> <head> >> <script...> >> document.ready(... >> $('button').click( >> $('#load_div').load(..some url.); >> }); >> </script> >> </head> >> <body> >> ..... >> <div id='load_div'> >> <script..> >> document.ready(){.....}); >> </script> >> <select> >> >> </div> >> </body> >> I saw a similar issue on the mailing list and wasn't clear with the >> response. Can someone provide me a code example. >> >> Regards, >> Ritesh >> >> -- >> ------------------------------------ >> Even a clock that does not work is right twice a day. >> ~Polish Proverb >> >> >> _______________________________________________ >> jQuery mailing list >> discuss@jquery.com >> http://jquery.com/discuss/ >> >> > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > > -- View this message in context: http://www.nabble.com/JQuery-IE7-and-document.ready-tf3207782.html#a8910213 Sent from the JQuery mailing list archive at Nabble.com. _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/