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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:30:35+00:00 2026-05-25T15:30:35+00:00

For example, if you click <div id=click-object-2></div> the option will switch to Earth ,

  • 0

For example, if you click <div id="click-object-2"></div> the option will switch to Earth, after that to Please choose, and finally back to Earth again.

I made a gif to show what I’d like to accomplish:

enter image description here

Anyone know of a Javascript that can do this?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Simulate clicks on options</title>
</head>

<style type="text/css">
div
{
width:30px;
height:30px;
margin:4px;
cursor:pointer;
}

#click-object-1{background-color:#F00;}
#click-object-2{background-color:#0F0;}
#click-object-3{background-color:#00F;}
#click-object-4{background-color:#FF0;}
</style>


<body>


<form action="">

  <fieldset>

    <ul style="list-style:none;">
      <li>
        <select id="select_items_first" name="SelectItemsFirst">
          <option value="choose">Please choose</option>
          <option id="fireaway" value="xjakgd">Fire</option>
          <option id="groundearth" value="yuygas">Earth</option>
        </select>
      </li>
      <li>
        <select id="select_items_second" name="SelectItemsSecond">
          <option value="choosemore">Please choose</option>
          <option id="watermelon" value="piowqe">Water</option>
          <option id="catchwind" value="mnbvzi">Wind</option>
        </select>
      </li>
    </ul>

  </fieldset>

</form>

<div id="click-object-1"></div>
<div id="click-object-2"></div>

<br />

<div id="click-object-3"></div>
<div id="click-object-4"></div>


</body>
</html>
  • 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-25T15:30:36+00:00Added an answer on May 25, 2026 at 3:30 pm

    This code should work :

    Simulate clicks on options

    <style type="text/css">
    div
    {
    width:30px;
    height:30px;
    margin:4px;
    cursor:pointer;
    }
    
    #click-object-1{background-color:#F00;}
    #click-object-2{background-color:#0F0;}
    #click-object-3{background-color:#00F;}
    #click-object-4{background-color:#FF0;}
    </style>
    <script type="text/javascript">
    function grabClick(selid , optionid){
    var arr = new Array();
    arr['empty'] = "0";
    arr['fireaway'] = 1;
    arr['groundearth'] = 2;
    arr['watermelon'] = 1;
    arr['catchwind'] = 2;
    changeTo(selid, arr[optionid]);
    setTimeout(function(){changeTo(selid, "0")}, 1000);
    setTimeout(function(){changeTo(selid, arr[optionid])}, 2000);
    }
    function changeTo(sd, od){
    var sel = document.getElementById(sd);
    sel.options[od].selected = true;
    }
    </script>
    
    <body>
    
    
    <form action="">
    
      <fieldset>
    
        <ul style="list-style:none;">
          <li>
            <select id="select_items_first" name="SelectItemsFirst">
              <option id="empty" value="choose">Please choose</option>
              <option id="fireaway" value="xjakgd">Fire</option>
              <option id="groundearth" value="yuygas">Earth</option>
            </select>
          </li>
          <li>
            <select id="select_items_second" name="SelectItemsSecond">
              <option id="empty" value="choosemore">Please choose</option>
              <option id="watermelon" value="piowqe">Water</option>
              <option id="catchwind" value="mnbvzi">Wind</option>
            </select>
          </li>
        </ul>
    
      </fieldset>
    
    </form>
    
    <div id="click-object-1" onclick='grabClick("select_items_first","fireaway");'></div>
    <div id="click-object-2" onclick='grabClick("select_items_first","groundearth");'></div>
    
    <br />
    
    <div id="click-object-3" onclick='grabClick("select_items_second","watermelon");'></div>
    <div id="click-object-4" onclick='grabClick("select_items_second","catchwind");'></div>
    
    
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When you click a certain element, an option will be selected. For example: you
Say I have the following code: <div onclick='location.href=http://www.example.com/'> <a href='#' onclick='alert(blah)'>click</a> </div> Is there
Here's an contrived example of what's going on: http://jsfiddle.net/adamjford/YNGcm/20/ HTML: <a href=#>Click me!</a> <div></div>
here is link to an example: http://techchorus.net/demos/jquery/hiding-input-elements-in-a-div.html It actally disables few elements on click
Javascript jQuery event handling If on event (for example 'click') bound one function for
Can hover and click functions be combined into one, so for example: click: $('#target').click(function()
Lets say for example: $(.button).click(function() { $.post(commandrunner.php, { param1: 'value', param2: 'value2', param3: 'value3'
Example: The user login to the webpage => Click on a button This action
Example: http://vincent-massaro.com/map/ Currently, the script allows you to click on a piece of the
Take the following example plugin: (function($) { $.fn.alertOnClick = function(text) { return this.each(function(){ $(this).click(alert(text));

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.