[jQuery] Re: Rebinding not working

2009-12-27 Thread mrtoner
I think I understand. As I recall, though, execution of the JS was
stopping because I didn't have '()' i there to start.

Thanks for the tips; my experience has been with PHP and, although I'm
not a pro at that yet, there are a number of differences between it
and JS.


On Dec 26, 11:35 pm, Michael Geary  wrote:
> That .live() code wouldn't work because what you've really written is:
>
>        var temp = exp_iphone_get_trans();
>        $('#transactions ul li a').live('click tap', temp);


[jQuery] Re: Rebinding not working

2009-12-26 Thread mrtoner
Ah, that worked! Now, could you explain why the other did not? (And,
BTW, I was only using .live('click',
exp_iphone_get_trans()), since live() works with only one event.)


On Dec 26, 5:57 pm, Leonardo K  wrote:
> Use the callback of load function
>
> $('#transactions').hide().load(url, function(){
>     $('#transactions ul li a').bind('click tap', exp_iphone_get_trans);
>
> }).fadeIn();
> On Sat, Dec 26, 2009 at 19:29, mrtoner  wrote:
> > Okay, the answer is probably obvious to you that are old hands at
> > jQuery, but I'm not seeing it. I finally figured out that if I load
> > new content via AJAX:
>
> >      $(document).ready(function(e){
> >        ...
> >        exp_iphone_get_sales();
> >      });
>
> >      function exp_iphone_get_sales() {
> >        ...
> >        $('#transactions').hide().load(url).fadeIn();
> >      }
>
> > I also need to rebind the click/tap (I'm using jQTouch) events to the
> > new content:
>
> >      function exp_iphone_get_sales() {
> >        ...
> >        $('#transactions').hide().load(url).fadeIn();
> >        $('#transactions ul li a').bind('click tap',
> > exp_iphone_get_trans);
> >      }
>
> > Unfortunately, clicking on one of the transactions:
>
> >      
> >        
> >           > id="7U735587N3003591E" class="slide">...
> >           ...
> >        
> >      
>
> > doesn't execute exp_iphone_get_trans(). And, oddly, when the page
> > loads, exp_iphone_get_trans() *is* executed -- no click or tap needed.
>
> > Using jQ 1.3.2; I also tried
>
> >        $('#transactions ul li a').live('click tap',
> > exp_iphone_get_trans());
>
> > to no avail. Any suggestions?