4
I’m not a professional developer, but as in any workplace, technical support does everything.
I was asked to create a support page for the external sales team, where they can include information about the customer in question. In such a case, simple information such as: Product X, do you have in place? YES or NO. If so, enter the value practiced by the customer.
I found it here in the website, an answer that helped me a lot with this. Follow the code I used:
PRODUTO X: <select name="produtox" id="valor_sim" required>
<option disabled selected value> -- Selecione uma opção -- </option>
<option value="SIM">SIM</option>
<option value="NÃO">NÃO</option>
</select><br>
<div id="inputOculto">
VALOR INTENSE: <input name="produtox_valor" id="valor_sim" type="number" min="0" max="9999"><br>
</div>
This is the JS code:
<script type='text/javascript'>
$(document).ready(function() {
$('#inputOculto').hide();
$('#valor_sim').change(function() {
if ($('#valor_sim').val() == 'SIM') {
$('#inputOculto').show();
} else {
$('#inputOculto').hide();
}
});
});
</script>
So far so good, the code works perfectly. The problem, is that in the next products, this does not work on them, only in the first. I did some research, and I saw that it could be because id is the same for everyone, and I found an answer about using the option this at that link, but as I do not understand the use and I do not know if it would be the case to use it, I ask for help in this situation.
Thank you.
+1 by having searched and put the links of the question, this is a match for the eyes, very good :) ah, here the support does not touch the code :D
– Ricardo Pontual
Thank you. I’ve looked for a lot of information here, and it has always helped a lot to have links. Hugs
– Leonardo - Paletitas