I would like to know how to get the select values and redirect them to display content on the page
In the example below, the redirect to another page is done, but I wanted the main content to be static and only display the javascript content below
JavaScript
<script>
function AbrirSecao(secao){
window.open(""+secao+"", "_parent");
}
</script>
HTML
<select name="unidade" id="unidade" onChange="AbrirSecao(this.value)">
<option value="">Selecione sua Cidade</option>
<option value="http://www.google.com.br">Sua Cidade 1</option>
<option value="http://www.google.com.br">Sua Cidade 2</option>
</select>
You can do it and you'll display the value of option in then paragraph tag with content ID:
function AbrirSecao(secao) {
let display = document.getElementById('content')
display.textContent = secao
}
<p id="content"></p>
<select name="unidade" id="unidade" onChange="AbrirSecao(this.value)">
<option value="">Selecione sua Cidade</option>
<option value="http://www.google.com.br#one">Sua Cidade 1</option>
<option value="http://www.google.com.br#two">Sua Cidade 2</option>
</select>