anchorage within select option

Asked

Viewed 81 times

-3

Is it possible? I have tried through A and option value but I need value with the information I pull from the bank if not the form doesn’t work

there is a way to place anchorage in select option???

  • 1

    To be more likely to help you recommend that you put together the question the code you are using .

  • Anchor to link or target? Inside as, in any specific option? It would be nice for you [Dit] to make it clear what you want, so avoid the staff responding on the kick (and then you will be able to take a better advantage of what is posted).

1 answer

1

What you can do is trigger an event by selecting a select option, for example;

//monitora alterações no select "#meu-select"
$(document).on("change", "#meu-select", function(e){
  if($(this).val() == "1"){
    //chama uma função ajax por exemplo que retorna os valores do banco
    //minhaFuncaoAjax()
  }
  
  //voce pode redirecionar para uma pagina com o resultado
  else if($(this).val() == "2"){
    location.href = "https://www.google.com"
  }
   
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<select id="meu-select">
  <option>Selecione</option>
  <option value="1">Opção 1 (chama função ajax)</option>
  <option value="2">Opção 2 (com redirecionamento) </option>
  <option value="3">Opção 3</option>
</select>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.