[Solved] change to using jquery
[ad_1] First, in your try example you are replacing input’s parent with select. Second, You have a lot of quotation typos. That would do: var input = $(‘#input’); if(input){ input.replaceWith(“<select id=’input’>” + “</select>”) } Also if you want to keep ‘#’ in your ids, escape them as freedomn-m suggested [ad_2] solved change to using jquery