I changed to this:
function loadEdit(){
    var linkval = $j('#edit').attr("href");
    $j('#jobinfo').load(linkval);
    return false;
}

And added the function itself to my link.  onclick=loadEdit();
The return false in the function isn't working.  If I put it in the onclick
(onclick=loadEdit(); return false;) then the page is loaded properly.
Otherwise the function (even with the return false in the function) is
allowing link to be followed anyway.


On 4/17/07 10:22 AM, "Shelane Enos" <[EMAIL PROTECTED]> wrote:

> 
> So I'm trying this:
> 
> $j(function(){
>     bindEdit = function(){
>         $j('#edit').bind("click", function(){
>             var linkval = $j(this).attr("href");
>             $j('#jobinfo').load(linkval, function(){
>                 bindEdit();
>             });
>             return false;
>         });
>     }
>     bindEdit();
> });
> 
> Which to me says bind an onclick function to an a tag with ID 'edit'.  Read
> the value of it's href (pages are dynamically loaded an hrefs change).  Load
> the link into the div id "jobinfo" and now call bindEdit to bind the click
> event to the edit link on the newly loaded page.  Return false so it doesn't
> follow the link as a normal link.
> 
> OK, so it doesn't work.  The page loads normally instead of into the div via
> ajax and I get "too much recursion" errors in the console.
> 
> Am I doing something wrong here?
> 
> 
> On 4/17/07 9:57 AM, "spinnach" <[EMAIL PROTECTED]> wrote:
> 
>> 
>> .bind('click') is faster because you bind it directly to the element,
>> .find() must first find the element inside the #jobinfo element and then
>> bind the appropriate event..
>> 
>> there is no difference between .bind('click') and .click(), .click is
>> just an alias for .bind('click').. and if i'm not mistaken, .click was
>> taken out of the core since 1.1 (i may be wrong, i know some aliases
>> were removed, but not sure which - so i just use .bind for everything :))..
>> 
>> dennis.
>> 
>> Shelane Enos wrote:
>>> What is the difference, advantage/disadvantage of these different methods:
>>> 
>>> bindEdit = function(){
>>> $j('#edit').bind("click", function(){
>>>             var linkval = $(this).attr("href");
>>>             $j('#jobinfo').load(linkval, function(){
>>>                 bindEdit();
>>>             });
>>>             return false;
>>>         });
>>> }
>>> 
>>> bindEdit = function(){
>>> $j('#jobinfo').find('#edit').click(function(){
>>>             var linkval = $(this).attr("href");
>>>             $j('#jobinfo').load(linkval, function(){
>>>                 bindEdit();
>>>             });
>>>             return false;
>>>         });
>>> }
>>> 
>>> 
>>> 
>> 
>> 
>> 
> 
> 

Reply via email to