Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8223219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:36:45+00:00 2026-06-07T14:36:45+00:00

I have a div which shows count like this: How can I change the

  • 0

I have a div which shows count like this:

How can I change the text from 0 to any word for example, when mouse is over the div, and revert to 0 when mouse leaves.

I tried this code, but it didn’t work.

$('.post-fav a').bind('mouseenter',function() {
    var default_text = $(this).text();
    $(this).css({'background-position' : 'left bottom', 'color' : '#1871a4'});
    $(this).html('<?php _e('favorite','deluxe'); ?>');
});
$('.post-fav a').bind('mouseleave',function() {
    $(this).css({'background-position' : 'left top', 'color' : '#666'});
    $(this).text(default_text);
});

The default text is variable, each element has specific count, I need someway to store the initial count when mouse moves over ..I can’t hard code it in js as 0 or any other count.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:36:49+00:00Added an answer on June 7, 2026 at 2:36 pm

    You just need to use the hover function, the first parameter is mouseover, the second is mouseout:

    $('div').hover(
        function() { $(this).html('anyword'); },
        function() { $(this).html('0'); }
    );
    

    EDIT:

    var storedtext;
    $('div').hover(
        function() { 
            storedtext = $(this).html();
            $(this).html('anyword'); 
        },
        function() { $(this).html(storedtext); }
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a #info div element which shows some text strings like below: <body>
I have this jquery script which suppose to hide/show div element base on the
I have a div which contain lots of input[type=text] fields. I want to put
I have an HTML Data which looks like: <div id=foo><a class=someClass href=http://somelink>Some Title</a></div> <div
I have this div which contents depends of the current time of HTML embedded
I have an ASP.NET GridView which is populated from a SQL Server database. This
I have a div which works fine <div id=fb-root></div> <fb:like href=<?php echo $link; ?>
On my page I have main div, which is generated by a plugin from
I have a popup DIV (js triggered) which shows an image. Very simple. The
Hi Guys i have two tables which look like this usertable RoleTable ----------------------- ---------------------------

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.