I replied to your initial duplicate post but maybe you are tracking
this one instead? Here is my post again:

Welcome to the list Maurice,

I tested this and it works:


$(function(){
       var $holder = $('#sometextholder');
       $('li').each(function(){
               var $$ = $(this);
               var $a = $$.find('a');
               var text = $$.text();
               $$.html($a);
               $a.hover(
                       function(){
                               $holder.append(text);
                       },
                       function(){
                               $holder.empty();
                       }
               );
       });
});


And here is a fully commented version of this same script:

$(function(){
       //get and store the holder div
       var $holder = $('#sometextholder');

       // loop through the li elements. You will want to apply
       // more context to the selector than this though
       $('li').each(function(){
               // store various bits of the DOM you will need later
               var $$ = $(this); // this li
               var $a = $$.find('a'); // the link in the li
               var text = $$.text(); // the full text in the li
               // make li contain only the link
               $$.html($a);
               // apply hover behaviour
               $a.hover(
                       // mouseover
                       function(){
                               $holder.append(text); // append this
li's original text
                       },
                       // mouseout
                       function(){
                               $holder.empty(); // empty the holder
                       }
               );
       });
});

Good luck.

Joel Birch.

Reply via email to