JSFiddle - React, Tailwind, and code Playground

by nickadeemus2002

HTML

<!-- bad select -->
<select id="1" name="option"></select>
<br /><br />
<!-- good select -->
<select id="2" name="option"></select>

JavaScript

// expected output: 
// <select name="option">Some <b>tags</b></select>

var htmlString = "Some <b>tags</b>";

//this is wrong
$('select#1').html('<p>'+htmlString+'</p>');


//you need to create an option for the select element
$('select#2').html("<option>"+htmlString+"</option>");