Function val() jquery tidak jalan

saya punya form inputan kaya gini :

saya mau pas isi quantity di form reject lalu klik submit maka secara otomatis kolom quantity manual jg keisi dgn nilai yg sama.

ini kodingannya :

<?php if (validation_errors()) : ?>
        <div class="alert alert-danger">
          <?php echo validation_errors(); ?>
        </div>
        <?php endif; ?>

<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script> <!-- modal pop up -->
<script src="<?php echo base_url('assets/js/bootstrap.min.js');?>"></script>
<script>
      $("#submit_qtyrev").click(function(){ //tombol reject
$("#qty_manual").val($("#qty_rev").val());
});
    </script>

    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h3 style="text-align:center;"><b>Data Produksi Gula Rafinasi</b></h3>
    </section>

                  <?php echo form_open('buku/simpan_input') ?>
                  <div class="col-sm-5" style="margin-left: 340px; margin-top: 25px">
                    <div class="form-group">
                      <label for="text">Tanggal</label>
                      <input type="date" name="tanggal" class="form-control" >
                    </div>
                    <div class="form-group">
                      <label for="text">Shift</label>
                      <select name="shift" class="form-control">
                        <option value="" selected>Pilih..</option>
                        <option value="1">(I). 24:00 - 08:00</option>
                        <option value="2">(II). 08:00 - 16:00</option>
                        <option value="3">(III). 16:00 - 24:00</option>
                      </select>
                    </div>
                    <div class="form-group">
                      <label for="text">Quantity</label>
                      <input type="text" name="qty" class="form-control" placeholder="Masukkan Quantity">
                    </div>
                    <div class="form-group">
                      <label for="text">Quantity Manual</label>
                      <input id="qty_manual" type="text" name="qty" class="form-control" placeholder="Masukkan Quantity manual">
                      <br>
                      <br>
                    </div>

                    <div class="form-group text-center">
                      <button type="button" data-toggle="modal" data-target="#confirm_input"class="btn btn-md btn btn-primary">Approve</button>
                      <button type="button" data-toggle="modal" data-target="#tambah-data" class="btn btn-md btn-primary">Reject</button>
                    </div>
                  </div>




       <?php echo form_open('buku/simpan_input') ?>
          <!-- Modal utk confirm input-->
          <div aria-hidden="true"  role="dialog" tabindex="-1" id="confirm_input" class="modal fade">
            <div class=modal-dialog modal-dialog-centered" role="document">
              <div class="modal-content">
                <div class="modal-header">
                  <h5 class="modal-title">Konfirmasi</h5>
                </div>
                    <form class="form-horizontal" action="<?php echo base_url('buku/simpan_input')?>" method="post" enctype="multipart/form-data" role="form">
                      <div class="modal-body">
                        <p class="modal-title">Apakah Anda yakin data sudah benar ?</p>
                      </div>
                        <div class="modal-footer">
                          <button type="submit" class="btn btn-sm btn-primary" href='<?php echo base_url() ?>buku/simpan_input/'>Ya</button>
                          <button type="button" class="btn btn-sm btn-primary" data-dismiss="modal">Tidak</button>
                        </div>
                      </form>
                    </div>
                </div>
            </div> <!-- end modal -->
          <?php echo form_close() ?>

           <?php echo form_open('buku/submit_reject') ?>
           <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="tambah-data" class="modal fade">
            <div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                  <h3 class="modal-title">Form Reject</h3>
                </div>
                    <form class="form-horizontal" action="<?php echo base_url('buku/submit_reject')?>" method="post" enctype="multipart/form-data" role="form">
                      <div class="modal-body">
                        <div class="form-group">
                          <label class="col-lg-2 col-sm-2 control-label">Nama</label>
                          <div class="col-lg-10">
                            <input type="text" class="form-control" name="nama" placeholder="Masukkan Nama">
                                  </div>
                                </div>
                                <div class="form-group">
                                  <label class="col-lg-2 col-sm-2 control-label">Alasan</label>
                                  <div class="col-lg-10">
                                    <textarea class="form-control" name="alasan" placeholder="Masukkan Alasan.."></textarea>
                                  </div>
                            </div>
                            <div class="form-group">
                              <label class="col-lg-2 col-sm-2 control-label">Quantity</label>
                              <div class="col-lg-10">
                                <input id="qty_rev" type="text" class="form-control" name="qty_rev" placeholder="Masukkan Quantity">
                              </div>
                            </div>
                        </div>

                        <div class="modal-footer">
                          <button id="submit_qtyrev" type="submit" data-toggle="modal" data-target="#confirm_reject"class="btn btn-md btn btn-primary">Submit</button>
                          <button type="button" class="btn btn-md btn btn-warning" data-dismiss="modal">Cancel</button>
                        </div>
                      </form>
                    </div>
                </div>
            </div> <!-- end modal -->

          <!--Modal utk confirm -->
          <div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="confirm_reject" class="modal fade">
            <div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title">Konfirmasi</h6>
                </div>
                    <form class="form-horizontal" action="<?php echo base_url('buku/submit_reject')?>" method="post" enctype="multipart/form-data" role="form">
                      <div class="modal-body">
                        <p class="modal-title">Apakah Anda yakin data sudah benar ?</p>
                      </div>
                        <div class="modal-footer">
                          <button type="submit" class="btn btn-sm btn-primary" href='<?php echo base_url() ?>buku/submit_reject/'>Ya</button>
                          <button type="button" class="btn btn-sm btn-primary" data-dismiss="modal">Tidak</button>
                        </div>
                      </form>
                    </div>
                </div>
            </div>

avatar syarika19
@syarika19

11 Kontribusi 0 Poin

Diperbarui 5 tahun yang lalu

1 Jawaban:

kalau dari saya baca sekilas sepetinya karena type nya submit gan <pre> &lt;button id="submit_qtyrev" type="submit" data-toggle="modal" data-target="#confirm_reject"class="btn btn-md btn btn-primary"&gt;Submit&lt;/button&gt; </pre> coba dihapus type="submit" nya

avatar kikimf
@kikimf

91 Kontribusi 78 Poin

Dipost 5 tahun yang lalu

Login untuk ikut Jawaban