jQuery addClass example
Change class name on click in jQuery
HTML
<form name="form10" id="my_form10" method="post" action="" >
<h5>Wil je keukenplinten laten inkorten na het leggen van de vloer?</h5>
<div class="radio8">
<div class="janee">
<input id="JA7" type="radio" name="group8" value="Ja">
<label for="JA7" class="form-field__radio__label">Ja, meerprijs € 20.00 per plint</label><br>
<input id="NEE7" type="radio" name="group8" value="Nee">
<label for="NEE7">Nee</label>
<br>
<input id="JA8" type="radio" name="group8" value="Ja">
<label for="JA8" class="form-field__radio__label">Ja, meerprijs € 20.00 per plint</label><br>
</div>
</div>
</form>
<form id="keukenplinten">
<div id="form_JA7" class="desc" style="float: inherit;">
<h5>Hoeveel keukenplinten wil je laten inkorten?</h5>
<input type="number" id="keukenplintenInkorten" name="keukenplinten">
</div>
<div id="form_JA8" class="desc" style="float: inherit;">
Ja, meerprijs € 20.00 per
</div>
</form>
CSS
.desc {
display: none;
}
JavaScript
$( document ).ready( function () {
$( "input[name=group8" ).change( function() {
var test8 = $(this).attr('id')
$( ".desc" ).hide();
$( "#form_" + test8 ).show();
} );
} );