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 8674997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:50:33+00:00 2026-06-12T19:50:33+00:00

Having a little trouble with jQuery, please help. I need to grab the contents

  • 0

Having a little trouble with jQuery, please help.

I need to grab the contents of p class=”area-desc when class=”caption is clicked and display it in class=”step-area.

html:

<ul id="main-areas" class="group">
                <li>
                    <div class="build-area">
                        <span class="caption bg">Planning</span>
                    </div>
                    <p class="area-desc">1Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a accumsan dolor. Curabitur rutrum augue nec eros blandit egestas. Aliquam lobortis posuere facilisis. Integer rutrum ullamcorper erat ac tempor. Nulla nec sapien nibh, non consequat dui.</p>
                </li>
                <li>
                    <div class="build-area">
                        <span class="caption bg">Arcitecture</span>
                    </div>
                    <p class="area-desc">2Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a accumsan dolor. Curabitur rutrum augue nec eros blandit egestas. Aliquam lobortis posuere facilisis. Integer rutrum ullamcorper erat ac tempor. Nulla nec sapien nibh, non consequat dui.</p>
                </li>
                <li>
                    <div class="build-area">
                        <span class="caption bg">Interior Design</span>
                    </div>
                    <p class="area-desc">3Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a accumsan dolor. Curabitur rutrum augue nec eros blandit egestas. Aliquam lobortis posuere facilisis. Integer rutrum ullamcorper erat ac tempor. Nulla nec sapien nibh, non consequat dui.</p>
                </li>
                <li>
                    <div class="build-area">
                        <span class="caption bg">Construction</span>
                    </div>
                    <p class="area-desc">4Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur a accumsan dolor. Curabitur rutrum augue nec eros blandit egestas. Aliquam lobortis posuere facilisis. Integer rutrum ullamcorper erat ac tempor. Nulla nec sapien nibh, non consequat dui.</p>
                </li>
            </ul>
            <div class="step-area bg">

            </div>

jQuery:

$('span.caption').click(function() {
        var step = $('p.area-desc').html();
        $('.step-area').html("<p>" + step + "</p>");
    });

At the moment all that code does is grabs the contents of the first p tag and displays it in the desired div.

What I need is a way of showing each description in .step-area on every click.

  • 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-12T19:50:34+00:00Added an answer on June 12, 2026 at 7:50 pm
    $('span.caption').click(function() {
        var step = $(this).parent().next().html();
        $('.step-area').html("<p>" + step + "</p>");
    });
    

    To display first description on page load:

    $(document).ready(function() {
        $('.step-area').html("<p>" + $('.area-desc:first').html() + "</p>");
    });
    

    Update: noscript

    Docs: https://developer.mozilla.org/en-US/docs/HTML/Element/noscript

    Example:

    <noscript>
      <style>
        /* override your styles here */
      </style>
    </noscript>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some trouble writing a jQuery function and could use a little help.
Having a little trouble on this one. I need a way using Jquery/JS to
I'm having a little trouble getting Jquery to play nice with cakephp and I'm
Question: I'm having a little trouble with jQuery: Consider this HTML, where I want
I'm having a little trouble using jQuery in Rails. I'd like to call the
I'm having a little trouble with JQuery autocomplete remote-cache and Zend, it doesn't work
Hi i am having a little trouble with my jquery tabs, for some reason
I'm making an image scroller with jQuery but I'm having a little trouble. I've
Ok, so I recently started learning jQuery, but I'm having trouble with a little
I'm having a little trouble with a jQuery plugin wrote. I've got it working

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.