Search code examples
phpjqueryhrefmouseover

Change the name of HREF link


I have the following link

<a href="example.com" id="example1"> Go to example....</a>

Is it possible that when a body moves the cursor over "Go to example..." it changes to "Go to example One" , i am using php and jquery. Any help will be appreciated.


Solution

  • The .hover() helper is useful here, to prevent annoying event bubbling:

    var elem = $('#examle1'), orig = elem.text();
    elem.hover(
        function() { $(this).text('Go to example One'); },
        function() { $(this).text(orig); }
    );