I have the following javascript function:
var opts = document.getElementById('id_endereco'); //localiza select
var str = opts.options[opts.selectedIndex].innerText; //Pega text do option
I need to remove part of the content of the select, 'str', this value is variable, but I have a fixed word in all options, the word is 'Address:'. I need to remove this word including everything that comes before it.
I tried:
var resultado_str = str.replace(0, str.indexOf("Endereço: ") + 1, "");
document.getElementById('endereco_correto').value = resultado_str;
But it did not work.