JSFiddle - React, Tailwind, and code Playground

by jasper

HTML

<div id="container-element"></div>

JavaScript

var str = 'waterfow"l||tvs||guitar||pillow||mouse',//the string to be split
    arr = str.split('||'),//the split string, each split stored in an index of an array
    out = '';//our output buffer variable

//iterate through each array index
for (index in arr) {
console.log(arr[index].replace('"', '/"'));
    //add this index to the output buffer
    out += '<option value="' + arr[index].replace('"', '\"') + '">' + arr[index] + '</option>';
}

//add the HTML we've built to the DOM, you can also use `.append(<code>)` instead of `.html(<code>)` but if you are using an ID for your select element then you ant to make sure and replace the HTML
$('#container-element').html('<select name="options" id="options">' + out + '</select>');