Note that there are some explanatory texts on larger screens.

plurals
  1. POSelecting a select option with a mouseover on a href= jquery
    text
    copied!<p>I want to change a select dynamically with a mouseover on an a href.</p> <p>The HTML: </p> <pre><code>&lt;select name = "modifiers[11]" id = "selectImg" class = "selectImg"&gt; &lt;option value ="43" &gt; Natural Black &lt;/option&gt; &lt;option value="44"&gt; Red &lt;!--(+$10.50)--&gt;&lt;/option&gt; &lt;option value ="45" &gt; Brown &lt;!--(+$10.50)--&gt;&lt;/option&gt; &lt;option value="46"&gt; Green &lt;!--(+$10.50)--&gt;&lt;/option&gt; &lt;option value ="47" &gt; Blue &lt;!--(+$10.50)--&gt;&lt;/option&gt; &lt;/select&gt; &lt;a id="18" href="#"&gt;link1&lt;/a&gt; &lt;a id="19" href="#"&gt;link2&lt;/a&gt; &lt;a id="20" href="#"&gt;link3&lt;/a&gt; &lt;a id="21" href="#"&gt;link4&lt;/a&gt; &lt;a id="22" href="#"&gt;link4&lt;/a&gt; </code></pre> <p>The Jquery:</p> <pre><code>$('#18 a').hover(function() { $('#43').attr('selected', 'selected'); }); $('#19 a').hover(function() { $('#44').attr('selected', 'selected'); }); $('#20 a').hover(function() { $('#45').attr('selected', 'selected'); }); $('#21 a').hover(function() { $('#46').attr('selected', 'selected'); }); $('#22 a').hover(function() { $('#47').attr('selected', 'selected'); }); </code></pre> <p>Here is a fiddle I've been working on. <a href="http://jsfiddle.net/NnEdM/3/" rel="nofollow">http://jsfiddle.net/NnEdM/3/</a> </p> <p>What am I doing wrong?</p> <p>EDIT</p> <p>I wanted to add, I found this jsfiddle, and it works on hover but my values don't start at 1 <a href="http://jsfiddle.net/SEqZG/23/" rel="nofollow">http://jsfiddle.net/SEqZG/23/</a></p>
 

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