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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:31:27+00:00 2026-06-07T20:31:27+00:00

I have a jQuery script running on an ASP site that shows hidden DIVs

  • 0

I have a jQuery script running on an ASP site that shows hidden DIVs when the id of a select form matches the div’s ID:

$(document).ready(function(){
    $('select[name$="_77"]').change(function() {
        $(".select_77").hide();
        $(".select_77[id='" + this.value + "']").show();
    })
})

The form truncated to only one option for this example:

<select name="option____jdfhj387___77">
    <option value="1922">Raisins</option>
</select>

And this is one of the many divs that gets unhidden:

<div id="select_image">
    <div class="select_77" id="1922" style="display:none;">
        <div class="border">
            <div class="content">
                <img src="photos/option/1922.jpg">
            </div>
        </div>
    </div>
</div>

The photos are medium sized, and it takes roughly 20-30 seconds for the page to load when I have 200+ of these images. Is there anyway to have the image load only when the parent div becomes visible, without having to manually put in every image url inside the script?

  • 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-07T20:31:29+00:00Added an answer on June 7, 2026 at 8:31 pm

    OK I figured it out after several hours of research.

    I found and added code that renames an attribute of an img tag with a matching ID selected under the form.

    $(document).ready(function(){
        $('select[name$="_77"]').change(function() {
            $(".select_77").hide();
            $(".select_77[id='" + this.value + "']").show();
            $("img.option[realsrc][id='" + this.value + "']").each(function() {
                var $t = $(this);
                    $t
                    .attr({
                        src : $t.attr('realsrc') /* Copies realsrc attribute and makes a src attribute*/
                    })
                    .removeAttr('realsrc'); /* Deletes the realsrc attribute */
        });
        })
    })
    

    Then I added class=”option” and id=”#” and renamed src= to realsrc=.

    <img class="option" id="1922" realsrc="photos/option/1922.jpg">
    

    Now when someone selects the option that matches the ID of the image, the image’s realsrc will be renamed to src and it will download and appear!

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

Sidebar

Related Questions

I have an ASP.net mvc page that executes a jquery script on load. The
I have a jquery script that attaches a click event to every link, running
I have a script (JS) running that will be making some different divs either
I have two scripts running on the same page, one is the jQuery.hSlides.js script
I have a jQuery script: $.ajax({ url: /scripts/secure/development/ajax.asp, type: POST, dataType: text, data: cmd=addresses,
I have this jquery script which suppose to hide/show div element base on the
I have a jQuery search script that uses tabs for the user to define
I have a JS/jQuery script that adds our leads (web contacts) to the DOM
I have a jQuery vote script that allows a user to vote on a
I have an ASP.NET MVC application that has a jQuery Treeview and a jQuery

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.