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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:35:18+00:00 2026-05-26T09:35:18+00:00

After populating some divs according to users’ selections I want to give them the

  • 0

After populating some divs according to users’ selections I want to give them the option to clear the data and start all over.

To fill in the divs with an image and a caption I’m using:

$('#options img').click(function () {
    var imageName = $(this).attr('alt');
    var chopped = imageName.split('.');
    $('#titleImage').empty();
    $('#titleImage')
        .prepend(chopped[0]);
    $img = $(this);
    $('#_targetDiv img').attr('src', $img.attr('src'));
})

And the to clear all divs:

$('#reset').click(function () {
    $('div[id^=title], div[id$=_targetDiv]').empty();
});

But after clicking ‘reset’ to start over and choosing an image from the menu the target div remains empty, though the title caption does appear. Why does that happen, and how can I correct it?

Thanks in advance.

  • 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-05-26T09:35:19+00:00Added an answer on May 26, 2026 at 9:35 am

    I’ve replicated this problem here: http://jsfiddle.net/nrabinowitz/tEkQb/1/

    If your HTML is like my HTML, the problem is that you’re deleting the element you are trying to update when you click. When you start out, you’ve got something like:

    <div id="_targetDiv">
        <img src="default.jpg">
    </div>
    

    But after you click Reset, you call .empty() on the _targetDiv element, so all you have is

    <div id="_targetDiv"></div>
    

    Assuming that your img tag has a default, maybe a 1×1 blank gif (oh man, when was the last time I used one of those?), you should just be resetting the src to the default, not deleting the element.

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

Sidebar

Related Questions

I am populating a DataWindow with some data. Some of the column names are
1.) My main.xml contains : <ListView android:id="@+id/lsym" android:layout_width="wrap_content" android:layout_height="wrap_content"/> 2.) After populating the list,
After discovering about Javascript namespaces, I tried to implement them but I run into
After a system upgrade i am no longer able to start my tomcat5 server.
After some time researching and trying different things I still cannot get my @ExceptionHandler
After a long search I'm still confused about it although I found some related
I'm adding some columns to one of my database tables, and then populating those
Issue I'm having is returning some data in a sidebar depending on which category
I am having some trouble populating a large plist into an array. Here is
I am using an EF code first generated database which provides some seed data,

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.