PHP and JS - How to create a form with sub selects

Asked

Viewed 21 times

0

My plan is to create a form where you have 2 selects. In the select #1 will have names transferred via Mysql. By choosing the desired name of select 1#, automatically displays desired name data.

Example

#1 select: joao, ruben
Selecionado: joao

#2 select:
Caso escolha o #1 joao: giro, feio, gordo etc
Caso escolha o #1 ruben: - gordinho, inteligente, lalalal

Is there some way created out there?

1 answer

-1

You can create two selects: the first for the person’s name, the second for the characteristics. The second starts invisible (display: None(no css) or .Hide()(no Function() of jquery)) When the val() of the first exists, the second appears (.show()). The function that will give this . show(), you will have an if to identify the value of the first select. Depending on which one, the second will receive the correct features added in the form: $("#primeiroInput"). html('blabla')

Browser other questions tagged

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