[jQuery] [jquery] what if the button wasn't there when the page loaded?

2007-01-13 Thread Daniel McBrearty
suppose we have some content to a page that gets loaded via AJAX in response to some other event ... it looks like this : input type=button id=some_new_button how do I bind to this, in a simple way? $(function() { $(#some_new_button).click( function() { ... }; }); doesn't work because the

Re: [jQuery] [jquery] what if the button wasn't there when the page loaded?

2007-01-13 Thread Daniel McBrearty
I'm looking at http://jquery.bassistance.de/jquery-getting-started.html#rate where it says: SNIP A very common problem encountered when loading content by AJAX is this: When adding event handlers to your document that should also apply to the loaded content, you have to apply these handlers

Re: [jQuery] [jquery] what if the button wasn't there when the page loaded?

2007-01-13 Thread Daniel McBrearty
thanks ... this still isn't making any sense to me though. the docs say that load Bind a function to the load event of each matched element. IOW ... it doesn't actually load anything - it causes some function to get executed each time that element finishes loading. I believe the online docs

Re: [jQuery] [jquery] what if the button wasn't there when the page loaded?

2007-01-13 Thread Mike Alsup
the docs say that load Bind a function to the load event of each matched element. But if you notice, the docs indicate there is more than one load function. The one you're quoting is a bind for the load event. You're invoking a load action directly for which the docs say: Load HTML from

Re: [jQuery] [jquery] what if the button wasn't there when the page loaded?

2007-01-13 Thread Webunity | Gilles van den Hoven
$('#myButton').click(function() { $('#myTarget').load('myfile.html' function() { alert('my callback'); }); }); The above says: when myButton is clicked, load myfile.html into myTarget and alert me when it's done. And then you can rebind any event handlers you want, but

Re: [jQuery] [jquery] what if the button wasn't there when the page loaded?

2007-01-13 Thread Daniel McBrearty
On 1/13/07, Mike Alsup [EMAIL PROTECTED] wrote: the docs say that load Bind a function to the load event of each matched element. But if you notice, the docs indicate there is more than one load function. The one you're quoting is a bind for the load event. You're invoking a load action