Try to search your question here, if you can't find : Ask Any Question Now ?

Looping form based on select option value

HomeCategory: stackoverflowLooping form based on select option value
Avatarkundan asked 2 weeks ago

I have select option input. When I choose the number on it and than click the button, I want to display the forms. The number of form displayed based on the select option I choose. I don’t know how to loop it in jquery and make the form display:none (before the button click the form is not visible). And is it posible to input more than one data in one table in the same time and how to do that? I’ve tried this
Thank You

  <div class="form-group col-sm-6">
   <label for="sel1">Jrekrut : </label>
   <select class="form-control" name="sel1" id="sel1" >
   <option selected>Pilih</option>
   <option value="1">1</option>
   <option value="2">2</option>
   <option value="3">3</option>
   <option value="4">4</option> </select>
   </div>
   <form class="form-horizontal striped-rows b-form" id="form1">
     <div class="card-body">
     <div class="form-group row">
     <div class="col-sm-3">
     <div class="b-label">
     <label for="inputEmail3" class="control-label col-form-label">Full Name</label>
     </div>
     </div>
    <div class="col-sm-9">
    <input type="text" class="form-control" id="inputEmail3" placeholder="Full Name Here">
       </div>
       </div>
</form>
     <script >
var num;
$('#sel1').on('change', function(event) {
   alert("This is the value selected in solutions: " + $(this).val());
   num = $(this).val();
});

$("#btn").click(function(){

    //$("#form1").hide();
    $("#form1").toggle();
    console.log(num);

  });

1 Answers
Best Answer
AvatarJyoti answered 2 weeks ago
Your Answer

2 + 15 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com