I think he may be talking about something different, think dynamic events in
the sense that a new list item is added via an ajax call and the click event
is bound to it. No need to re-call the bind to attach the event after the
ajax content has loaded...
$('li").behavior( "click", function() {
$(this).load("menu.html");
});
Cheers,
-Jonathan
On 4/26/07, Jonathan Chaffer <[EMAIL PROTECTED]> wrote:
On Apr 26, 2007, at 17:18 , Starbow wrote:
> I was just watching the video of John Resig at Yahoo, and in one slide
> he talked about behaviors, as jquery bindings that act like css rules
> and apply themselves to html fragments asynchronously loaded into the
> page. The code sample looked like this:
>
> $(document).ready( function() {
> $('li").behavior( "click", function() {
> $(this).load("menu.html");
> });
> });
>
> Is behavior a special jQuery function, something that is in the works,
> or is it just a regular function and the code for it was missing from
> the slide set?
Looks like a typo for .bind(). This will work:
$(document).ready(function() {
$('li').bind('click', function() {
$(this).load('menu.html');
});
});