That did it! You were correct that I had a copy and paste error above. I believe you are also correct that I should have done this with .load() instead.
I didn't know there was an ajaxSuccess() handler -- I was struggling to try to get it to work with .live() and .delegate() but your method works for me. Thanks again for the help man. Really appreciate web2py and this community. --Mike On Thursday, August 9, 2012 7:02:11 PM UTC-4, Anthony wrote: > > Here is your code reformatted: > > jQuery(".big_search").keyup(function() { > ajax('partial_search', ['big_search'], 'search_hint') > }); > $('.button').button(); > }); > > The call to .button() happens outside the .keyup() callback (unless that > was a copy/paste error). Even inside, though, I don't think it will wait > for the ajax call to complete. Instead, you might consider using the jQuery > .load() or .ajax() functions directly, both of which take a callback (which > executes after the ajax call completes). Or you could set up a separate > .ajaxSuccess() event handler: > > jQuery('.big_search').ajaxSuccess(function(e, xhr, settings) { > if (settings.url == 'partial_search') { > jQuery('.button').button(); > } > }); > > I'm not familiar with jQuery UI .button(), though, so there may be other > problems with your approach. > > Anthony > > On Thursday, August 9, 2012 6:24:38 PM UTC-4, Mike wrote: >> >> I guess this is really more of a jquery question but I figured there may >> be some easier web2py builtin way to do this... >> >> I'm doing some custom auto completion on an input field and thought the >> example from the book made more sense for my usage (as opposed to the built >> in autocomplete widget). That part is working great: >> >> ** book example code: >> >> <form> >> >> <input type="text" id="month" name="month" style="width: 250px" /><br /> >> >> <div style="position: absolute;" id="suggestions" >> >> class="suggestions"></div> >> >> </form> >> >> <script> >> >> jQuery("#month").keyup(function(){ >> >> ajax('month_selector', ['month'], 'suggestions')}); >> >> </script> >> >> >> Okay so the problem I'm having is that instead of Months like the example >> above, I am returning divs with class of 'button' and using jquery ui to >> try to turn those into buttons after they are loaded in. I'm having trouble >> with the jquery syntax here. >> >> right now I have: >> >> jQuery(".big_search").keyup(function(){ >> >> ajax('partial_search', ['big_search'], 'search_hint')}); >> >> $('.button').button(); >> >> >> >> }); >> >> >> The buttons flash for a second and quickly disappear. Can someone throw >> me some pointers here or a better place to look? >> >> Thanks in Advance! >> >> >> >> > --