[Solved] change to using jquery


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

solved change to