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

  • Home
  • SEARCH
  • 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 8952143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:48:39+00:00 2026-06-15T13:48:39+00:00

Hopefully just a quick question :) I’m trying to write little jQuery that will

  • 0

Hopefully just a quick question 🙂

I’m trying to write little jQuery that will help do this:

  • text displayed on page: CA
  • text displayed when mouse hovers: CALIFORNIA

I’ve managed to do this the wrong way round unfortunately, I know I need to use the .hide() function but I just can’t figure out how to use it. Sorry I’m pretty new to jQuery and just trying to get my head round it.

Here’s a jfiddle I made link, preferably the text would slide in from the right. I’ve tried using a span but it seemed to work better having p tags in different divs. I understand that I’ll need to put the HTML all on one line to get rid of the little space between CA and LIFORNIA. could anyone possibly please assist?

HTML:

<div class="state">
     <p>CA</p>
</div>
<div class="state-full">
     <p>LIFORNIA</p>
</div>

CSS:

.state, .state-full {
     display: inline-block;
     cursor: pointer;
}

jQuery:

$('.state').hover(function() {
     $('.state-full').slideToggle(100, 'linear');
     $('.state-full').display(100, 'linear');
});

Many thanks!

  • 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-15T13:48:40+00:00Added an answer on June 15, 2026 at 1:48 pm

    The code you had would work fine, you just need to modify your HTML and CSS a little to make it more semantic. Try this:

    <div class="state">      
        <span>CA</span>
        <span class="state-full">LIFORNIA</span>
    </div>
    
    .state, .state-full { cursor: pointer; }
    .state-full { display: none; }
    .state span { float: left; }
    
    $('.state').hover(function() {
        $('.state-full', this).slideToggle(100, 'linear').display(100, 'linear');
    });
    

    Note that I added a context to the selector as I assume you’re going to have more than one of these on the page.

    Example fiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just a quick regex question...hopefully I have a string that looks something like this:
Just a (hopefully) quick question to clear something up with how Javascript handles objects.
Just a (hopefully) quick question, I have the following HTML code: <tr> <td><img src=img/icons/file_pdf.png></td>
Just a quick one, hopefully. I've coded up this: <script> $(div.design-project).css('display', 'none'); function InsertContent(tid)
im struggling with syntax here: hopefully this question is v simple, im just miising
quick question I'm struggling with, hopefully I've just got a brain-blockage and I'm missing
Hopefully this is a quick and easy question to answer. Do I need the
Just a quick question (hopefully). I want to slide one div in front of
Ok guys, just a quick question hopefully someone can find my mistake quickly, but
Hopefully this is just a quick one and I'm missing something simple... I've got

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.