Welcome Guest, Not a member yet? Register   Sign In
form generated when choosing radio button using codeigniter
#1

Hi everyone i want to asking how to make a form generated when i choose the option using checkbox or radio button. the form will appear when i choose the option button(manager) and if i choose the option(admin) the form will not appear. can someone give the sample code with javascript or can share the link so i can refer to. for example what i try to do is, i have a form which is user need to fill up

full name
address
user type(radio button)
admin
manager
when user choose as a manager the form will automatically appear and ask for fill more form like

location store
how many staff u have
store name
Thanks.
Reply
#2

Try this

$("#usertype").hide();
$('#chkuser').change(function () {
repeatCheck('chkuser');
});


function repeatCheck(valCheck) {
if ($('#' + valCheck).is(':checked') === true) {
$("#usertype").show();
} else {
$("#usertype").hide();
}
;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
Usertype<input type="checkbox" name="chkuser" id="chkuser">

<div id="usertype" class="form-group" >


<div class="col-md-9">

<input type="checkbox">manager</input>
<input type="checkbox" >admin</input>




</div>
</div>
Reply




Theme © iAndrew 2016 - Forum software by © MyBB