mardi 29 mars 2016

I need help showing and hiding data based on a checkbox.

Alright so I have a form... in the form I have a lot of check boxes... if a person clicks on the checkbox... it shows the field below the box... if they click on the checkbox again it makes the field below the checkbox disappear and makes the field have no value...

here is the code... I have JS running the show and hide. and Html calling it.

function ShowCutSewDescription() {
var select = $('#send_item_to_cutsew');
console.log(select)
//select = parseInt(select);
if (select.attr('checked', true)) {
    $('#cutsew-checked').show();
}
else {
    $('#cutsew-checked').hide();
}

}

<div class="form-group">
<label class="col-md-3 control-label">Sending item to Cut/Sew Manager</label>
<div class="col-md-9">
    <input type="checkbox" name="send_item_to_cutsew" class="form-control input-inline input-medium" placeholder="Enter text" onchange="ShowCutSewDescription()">
</div>




Aucun commentaire:

Enregistrer un commentaire