Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's a little sample to get you started: <a href="http://jsfiddle.net/eUDRV/3/" rel="nofollow noreferrer">http://jsfiddle.net/eUDRV/3/</a></p> <p>This example will move items (one or multiple) from the left to the right and back again. Whatever item(s) are selected in the right side will update the textbox on the right side.</p> <p>We are using the elements:</p> <ul> <li><code>select</code></li> <li><code>input type="button"</code></li> <li><code>input type="text"</code></li> </ul> <p>Framed by:</p> <ul> <li><code>div</code></li> <li><code>section</code></li> </ul> <p>Styled with simple CSS. Functionality is provided with JavaScript.</p> <p>I'm using the jQuery library to make things a little easier. This could also be done with pure JavaScript.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$("#btnLeft").click(function () { var selectedItem = $("#rightValues option:selected"); $("#leftValues").append(selectedItem); }); $("#btnRight").click(function () { var selectedItem = $("#leftValues option:selected"); $("#rightValues").append(selectedItem); }); $("#rightValues").change(function () { var selectedItem = $("#rightValues option:selected"); $("#txtRight").val(selectedItem.text()); });</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>SELECT, INPUT[type="text"] { width: 160px; box-sizing: border-box; } SECTION { padding: 8px; background-color: #f0f0f0; overflow: auto; } SECTION &gt; DIV { float: left; padding: 4px; } SECTION &gt; DIV + DIV { width: 40px; text-align: center; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;section class="container"&gt; &lt;div&gt; &lt;select id="leftValues" size="5" multiple&gt;&lt;/select&gt; &lt;/div&gt; &lt;div&gt; &lt;input type="button" id="btnLeft" value="&amp;lt;&amp;lt;" /&gt; &lt;input type="button" id="btnRight" value="&amp;gt;&amp;gt;" /&gt; &lt;/div&gt; &lt;div&gt; &lt;select id="rightValues" size="4" multiple&gt; &lt;option&gt;1&lt;/option&gt; &lt;option&gt;2&lt;/option&gt; &lt;option&gt;3&lt;/option&gt; &lt;/select&gt; &lt;div&gt; &lt;input type="text" id="txtRight" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/section&gt;</code></pre> </div> </div> </p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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