A Pen by nikitaindik

Thumbnail
This awesome code was written by nindik, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright nindik ©
  • HTML
  • CSS
  • JavaScript
    <select multiple>
  <option>Мотоцикл</option>
  <option>Собака</option>
  <option>Автомобиль</option>
  <option>Трактор</option>
</select>

<select multiple>
</select>

/*Downloaded from https://www.codeseek.co/nindik/a-pen-by-nikitaindik-NydRXx */
    select {
  border: 1px solid black;
  width: 100px;
  float: left;
}


/*Downloaded from https://www.codeseek.co/nindik/a-pen-by-nikitaindik-NydRXx */
    $('option').on('click', (event) => {
  const $clickedOption = event.target;
  const $currentContainer = $($clickedOption).parent('select');
  const $targetContainer = $('select').not($currentContainer);
  
  $targetContainer.append($clickedOption);
});

Comments