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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:41:49+00:00 2026-06-09T11:41:49+00:00

I have a div with text and a separate div with a jpg image

  • 0

I have a div with text and a separate div with a jpg image on a web page.

There are six (jpg) buttons in different areas on the web page.

When I select btn1.jpg, I would like text1.html and image1.jpg to load into the two div’s.

When I select btn2.jpg, I would like text2.html and image2.jpg to replace the content of the div.

When I select btn3.jpg, I would like to have text3.html and image3.jpg load into the div’s.

and so forth…

When one initially lands on the page, I would like to have the text and image associated with btn1.jpg loaded in the divs by default.

  • 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-09T11:41:51+00:00Added an answer on June 9, 2026 at 11:41 am

    I’ve created this jsFiddle http://jsfiddle.net/davew9999/gFHnh/ that should do what you want. I’ve just done 2 buttons with 2 sets of text and images but you can just add more html buttons, the JavaScript will deal with as many buttons as you like.

    Note that no text loads as text1.html and text2.html doesn’t exist for me but should work for you. Also I’ve used some example images from the web just to show it works.

    HTML

    <button id="button1" class="textImageChanger" data-image="http://www.transformerhair.com/wp-content/uploads/2010/11/test.jpg" data-html="text1.html">Button1</button>
    <button class="textImageChanger" data-image="http://upload.wikimedia.org/wikipedia/commons/9/95/KWF_Test.png" data-html="text2.html">Button2</button>
    
    <div id="textDiv"></div>
    <div id="imageDiv"><img src=""/></div>
    

    JavaScript

    function LoadText(link) {
        $("#textDiv").load(link);
    }
    
    function LoadImage(image) {
        $("#imageDiv img").attr("src", image);
    }
    
    
    $(document).ready(function() {
        LoadText("text1.html");
        LoadImage($("#button1").data("image"));
    
        $(".textImageChanger").click(function() {
            LoadText($(this).data("html"));
            LoadImage($(this).data("image"));
        });
    });
    

    ​

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

Sidebar

Related Questions

I have a div which has some text, but according to different situations this
I have a div with a width of 200px. There is text inside that
I have a div. When there is a big text then scroller comes on
I have a sequence of 5 different images each in a separate div. Underneath
I have created a function to showing a title text in a separate div,
I have 1 div and 1 text input field, the div is visible and
I have a div element containing some text. When the user clicks a word
I have a div, containing text and a few links. I want to trigger
I have two div's one has textbox in it and other just plain text.
I have a div on the left hand side, and text on the right

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.