Note that there are some explanatory texts on larger screens.

plurals
  1. POForms: Jquery: multiple options updating dependant hidden field with multiple corresponding values
    primarykey
    data
    text
    <p>I can't quite get my head around this idea, wonder if someone could help out please?</p> <p>I have a form with 12 options, option '1' is selected by default. There is a hidden field that is populated with corresponding values.</p> <p>What I want to achieve is: When option 1 is selected, the value of the hidden text field updates to "Opt1", and so on through to "Opt12"</p> <p>I hope the following renders correctly as XHTML</p> <p>The best way for me to explain if I may, is as follows</p> <pre><code> &lt;select name="somethingName" id="SomethingID"&gt; &lt;option value="1" selected="selected"&gt;Option #1&lt;/option&gt; &lt;option value="2ABC"&gt;Option #2&lt;/option&gt; &lt;option value="3ABC"&gt;Option #3&lt;/option&gt; &lt;option value="4ABC"&gt;Option #4&lt;/option&gt; &lt;option value="5ABC"&gt;Option #5&lt;/option&gt; &lt;option value="6ABC"&gt;Option #6&lt;/option&gt; &lt;option value="7ABC"&gt;Option #7&lt;/option&gt; &lt;option value="8ABC"&gt;Option #8&lt;/option&gt; &lt;option value="9ABC"&gt;Option #9&lt;/option&gt; &lt;option value="10ABC"&gt;Option #10&lt;/option&gt; &lt;option value="11ABC"&gt;Option #11&lt;/option&gt; &lt;option value="12ABC"&gt;Option #12&lt;/option&gt; &lt;/select&gt; &lt;input type='hidden' id='myhidden' value=''&gt; </code></pre> <p>If/When Option #1 is selected, the value of myHidden is equal to "Opt1" If/When Option #2 is selected, the value of myHidden is equal to "Opt2"</p> <p>and so on. I say if/when for the idea that the hidden text field is updated on select.</p> <p>Can anyone please suggest how I would achieve this with Jquery?</p>
    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.
    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