Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>What you need is, when the "add" button is clicked, a simple javascript function is called that retrieves: the text, selection1 &amp; selection2 => build a new option with these information the append it to the result list.</p> <p>Key javascript functions:</p> <pre><code>- document.getElementById - document.createElement - appendChild </code></pre> <p>In your html the form/submit button must be around your result list only.</p> <p>Example (<a href="http://jsfiddle.net/jKqyt/3/" rel="nofollow">jsfiddle link</a>):</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script&gt; function add() { var txt = document.getElementById("txt").value; var sel1 = document.getElementById("sel1").value; var sel2 = document.getElementById("sel2").value; var result = txt + " " + sel1 + " " + sel2; var resultOption = document.createElement("option"); resultOption.value = result; resultOption.text = result; document.getElementById("selResult").appendChild(resultOption); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;input id="txt" type="text" /&gt; &lt;select id="sel1"&gt; &lt;option value="value11"&gt;value11&lt;/option&gt; &lt;option value="value12"&gt;value12&lt;/option&gt; &lt;option value="value13"&gt;value13&lt;/option&gt; &lt;/select&gt; &lt;select id="sel2"&gt; &lt;option value="value21"&gt;value21&lt;/option&gt; &lt;option value="value22"&gt;value22&lt;/option&gt; &lt;option value="value23"&gt;value23&lt;/option&gt; &lt;/select&gt; &lt;input type="button" value="add" onClick="javascript:add()"/&gt; &lt;br/&gt; result: &lt;form action ="." method="post"&gt; &lt;select id="selResult"&gt;&lt;/select&gt; &lt;input type="submit" value="submit"/&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

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