Change CSS element depending on the SELECT option using jQuery

Asked

Viewed 51 times

3

I’m having a hard time making a certain interactivity on my site. For example, there is a select in HTML with 3 options, and when the user selects certain option, there would be a change in the CSS of an element, all this using jQuery.

How could I set the value of this option and then do the check I need?

Excerpt described:

<select name="tipoCliente" id="tipo_cliente">
    <option>Selecione*</option>
    <option value="Tipo 1">Tipo 1</option>
    <option value="Tipo 2">Tipo 2</option>
    <option value="Tipo 3">Tipo 3</option>
</select>

CSS of the element to be changed depending on the option selected above (by default it is none, after the selection has been block):

#formsgeral{
  display:none;
}
  • 2

    You can show the relevant fragments of your code?

  • 1

    Related: http://answall.com/questions/25440/aparecer-uma-div-consoante-a-select-picking/25442#25442

  • @Sergio, I almost vote as a duplicate... the solution there is the same as here, right? What do you think, Kaleb?

  • 1

    You’re right @brasofilo. I’m running in the same way as related. Thanks man! And thanks @Sergio! : D

No answers

Browser other questions tagged

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