1
I believe I already have a question answered more or less with what I want, but I do not know much of js and could not filter necessary information in what I read ... THEN!
I wonder how you could make it so that once I selected the <option value="Jurídica">
of my <select>
, the <input id="name">
automatically change your placeholder="* Nome Completo"
for placeholder="*Nome de sua Empresa"
and that in the <input name="cpf">
were added to the property disabled
or readonly
.
<form>
<select name="pessoa" id="pessoa">
<option value="Não especificado">*Tipo de Pessoa</option>
<option value="Física">Física</option>
<option value="Jurídica">Jurídica</option>
</select>
<input name="nome" id="nome" placeholder="Nome Completo">
<input name="icpf" id="icpf" placeholder="CPF">
<input name="icnpj" id="icnpj" placeholder="CNPJ">
Follows form in Jsfiddle http://jsfiddle.net/LhanL/
Js is too expensive, I’m studying but it’s so much that I can focus on 1 ... @Sergio but there’s one thing, without wanting to abuse, assuming the fields
CPF
andCNPJ
areDisabled
how do I make it when the person chooses the type of personFísica
enable the CPF field and when to chooseJurídica
enable the fieldCNPJ
? And without wanting to abuse already, can you leave the message "Select the type of person" while the fields are disabled? Thank you in advance!– Vinicius Colares
@Viniciuscolares, I forgot the part about
disabled
. Here it goes. However I begin to think you could do otherwise. You could hide the field instead of being disabled. Then the user doesn’t even notice that the input changes. Or rather, just use an input and check with Regex which number you entered... However jsFiddle: http://jsfiddle.net/z2jfx/1/– Sergio
I liked your idea, but the way it looks is great, I only have a doubt, in the case of this js that you did, when I choose the value
Jurídica
he adds the propertyvalue
with the respective value ... it is possible to addvalue
add propertyPlaceholder
?– Vinicius Colares
@Viniciuscolares, yes of course, you can use
input.placeholder = valor == 'Jurídica' ? '* Nome de sua Empresa' : '* Nome Completo';
.– Sergio
I don’t understand ... I typed this and it didn’t work, then copy the q vc suggested and it worked! UHSAUHSAUHSAHUSAHUASHUAS
– Vinicius Colares
@Viniciuscolares, boa! If you think the answer solves your problem you can mark as accepted.
– Sergio
was bad, had already marked as "accepted" but had given a bug srsrsrsrsrs ?
– Vinicius Colares
@Viniciuscolares, http://jsfiddle.net/z2jfx/2/
– Sergio
Thanks @Sergio you know paranauê ... agr enough abuse, just wanted to know if you have any book or online course that can indicate, so I can learn in a practical and fast way these simple and pure techniques in Js!
– Vinicius Colares
@Viniciuscolares, this site is the best school. You want to ask good questions, then study the problem better => When the answer comes you are receptive and understand the solution much better.
– Sergio
I agree but I feel abusive, because type ... dps who sent me this js I’m more than half an hour trying to change it to leave the form as I said and I can’t, but I’m bothered to keep asking! XD
– Vinicius Colares
@Viniciuscolares, if it is a new problem or next step of the previous question, and you can’t solve it yourself, so ask another question. There will be people helping.
– Sergio
look at this, I was able to do it here ... http://jsfiddle.net/z2jfx/4/
Selecione o tipo de pessoa
do select when Physical or Legal is active, you can do this for me?– Vinicius Colares
@Viniciuscolares :) http://jsfiddle.net/z2jfx/5/
– Sergio
=D this is very angry became perfect ... Valew!
– Vinicius Colares