-4
In a form, you will have the yes or no option, if yes the user will describe
$(document).ready(function() {
$('#descreva').hide();
$('#def').change(function() {
if ($('#sim') checked) {
if( $("#sim").is(":checked") == true)
$('#descreva').show();
} else {
$('#descreva').hide();
}
});
});
<div class="campo">
<label><strong>Possui treinamento: </strong></label>
<script type="text/javascript" src="java.js"></script>
<radio id="def">
<div>
<input type="radio" name="devweb" id="sim" value="sim">
<label for="sim">SIM</label>
</div>
<div>
<input type="radio" name="devweb" id="nao" value="nao">
<label for="nao">NÃO</label>
</div>
<div>
<input type="text" name="descreva" id="descreva">
</div>
if ($('#sim') checked) {
if that doesn’t make sense, it lacks a logical operator.. anyway, a radio is an element that has multiple values, so it can validate the direct value instead of "checked", thus:if ($('input:radio[name="devweb"]').val() == "sim")
– Ricardo Pontual