JSFiddle - React, Tailwind, and code Playground

by Akram kamal

HTML

<h3>Your Interests</h3>

<ul id="destinationList"></ul>
 <h3>Add Interests</h3>

<ul id="sourceList">
    <li>item 1</li>
    <li>item 2</li>
    <li>item 3</li>
    <li>item 4</li>
    <li>item 5</li>
    <li>item 6</li>
    <li>item 7</li>
    <li>item 8</li>
    <li>item 9</li>
</ul>

JavaScript

$("li").click(function (e) {
    var destTable = "destinationList";
    if ($(this).parents("ul").attr("id") == "destinationList") {
        destTable = "sourceList";
    }
    $(this).appendTo("#" + destTable);
});