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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:19:51+00:00 2026-05-28T06:19:51+00:00

I currently have a HTML select box like below. <select name=item_1> <option value=0>Choose one…</option>

  • 0

I currently have a HTML select box like below.

<select name="item_1">
      <option value="0">Choose one...</option>
      <option value="1">Value (1)</option>
      <option value="2">Value (2)</option>
      <option value="3">Value (3)</option>
</select>

I have to do the following. Either way works, but I want to learn both, if possible.

A.

  1. Imagine there is 3x different select boxes called item_1, item_2 and item_3.
  2. Imagine a div (or a table) on any place of current document.
  3. Whenever the value on select box changes, the div should contain a link to picture with option value.

For example, if “Value (2)” gets selected in “item_1” selectbox, then it should print 2.jpg on the div. If there are selected values in other selectboxes, it should also be printing their images.

Example:
item_1 -> Value (2) —
item_2 -> Value (3) —
Output -> < img src=”2.jpg”>, < img src=3.jpg”>

How can I do this?

B.

The same question as above, except; instead of directly printing the picture link depending on selectbox value, we will do a AJAX request to our PHP file. PHP will return the additional information about the selected value in selectbox. (e.g if you selected “value 2”, it may get it’s price, stock_count or picture_path or w/e from database.)

Depending on the returned values, we will get image_path value from database so instead of printing 2.jpg, it may print my_cute_dog.jpg.

How can I do this? I’ll be glad if you can guide me.

Thank you,
Anil

Ps. No need to code PHP. Just give me the PHP file name, parameters and method. (POST prefered). I just need some basic jQuery/JS help, or guidance.

Ps. 2 You can name divs however you want.

  • 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-28T06:19:52+00:00Added an answer on May 28, 2026 at 6:19 am

    The first part of your question is easy. Bind to the change event for your dropdown list. Then access $(this).val() to get the newly selected value.

    You can then modify the src attribute of an existing image to be the new value. Note that I use prop here because I am in jQuery 1.7+. If you are not using newer jQuery then use attr instead.

    Finally there are a number of AJAX methods cooked into jQuery. I chose load, but you could use something more complex like get or ajax for more fine grained control of the returned values. Load basically takes whatever is returned by the server and stuffs it into the matched elements.

    http://jsfiddle.net/LHpJd/

    //for select list with id of `select`
    $('#select').change( function() {
        var value = $(this).val();
        //directly set value as html
        $('#output').html(value);
    
        //change image url source
        $('#output img').prop('src', 'http://' + value);
    
        //change image url source from server (expected return value is something like <img src="" />
        $('#output').load('myfile.php?' + value);
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a single item HTML select box on which I'd like to find
I currently have the following MySQL statement to replace the HTML entity for a
I am using jquery validation plugin. I have an html that looks like: <h2>Select
In my application, I have an HTML select box from which I remove and
I currently have two apps: app1/ app2/ templates/ app1.html app2.html In app1.html, I'm including
I currently have a product view page that contains an MVCContrib HTML Grid with
I have an html table with many rows. I'm currently grouping several rows inside
I have this command that I run every 24 hours currently. find /var/www/html/audio -daystart
I have the following before_filter : def find_current_membership respond_to do |wants| wants.html { @current_membership
I have a HTML page that contains a search box containing a number of

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.