0
I have a question in string comparison using Javascript / jQuery.
I want you to get the town on input id="cidade"
is not Goiânia
or Aparecida de Goiânia
display the
alert
.
But even when the city is Goiânia
the alert
is being displayed. According to the example below I have already set the value manually as Goiânia
for testing.
$( "#botao" ).click(function() {
var verificarcidade = $('#cidade').val();
if (verificarcidade != 'Goiânia' || verificarcidade != 'Aparecida de Goiânia' ){
alert('Parar');
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="cidade" type="text" value="Goiânia" required />
<a href="#" id="botao" role="button">Calcular</a>