Note that there are some explanatory texts on larger screens.

plurals
  1. POClick element will select option
    primarykey
    data
    text
    <p>When you click a certain element, an option will be selected.</p> <p>For example: you click on a Div element with id="object3", this action will automatically select the Option element "Item 3".</p> <p>Anyone know a Javascript that can do this?</p> <p><a href="http://jsfiddle.net/zFuCc/" rel="nofollow">HTML example</a></p> <p><br /></p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Click tag will select option&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form action=""&gt; &lt;fieldset&gt; &lt;ul style="list-style:none;"&gt; &lt;li&gt; &lt;select id="select_items" name="SelectItems"&gt; &lt;option value="Item1"&gt;Item 1&lt;/option&gt; &lt;option value="Item2"&gt;item 2&lt;/option&gt; &lt;option value="Item3"&gt;Item 3&lt;/option&gt; &lt;option value="Item4"&gt;item 4&lt;/option&gt; &lt;/select&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;div id="object1" style="background-color:#F00;width:30px;height:30px;margin:4px;cursor:pointer;"&gt;&lt;/div&gt; &lt;div id="object2" style="background-color:#0F0;width:30px;height:30px;margin:4px;cursor:pointer;"&gt;&lt;/div&gt; &lt;div id="object3" style="background-color:#00F;width:30px;height:30px;margin:4px;cursor:pointer;"&gt;&lt;/div&gt; &lt;div id="object4" style="background-color:#FF0;width:30px;height:30px;margin:4px;cursor:pointer;"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload