jeudi 8 septembre 2016

Button for checkall using jquery

I have some problem to make button for check all my checkbox Here some my code Thanks before

<input type="checkbox" form="form_koleksi<?php echo $cari_id; ?>" id="kodestock<?php echo $kode.$kode_unit; ?>" name="infostock<?php echo $kode_unit; ?>" value="<?php echo $kode_unit.";;".$kode.";;".$HJual.";;".$isbn.";;".$halaman; ?>">
    <label for="kodestock<?php echo $kode.$kode_unit; ?>">
        <?php echo $kode; ?>
    </label>
</input>

this my checkall

<button type="submit" name="checkall">CHECK ALL</button>

My JQuery

$("[name='checkall']").click(function(){
        if($(this).html() == "CHECK ALL"){
            $(".infostock<?php echo $kode_unit; ?>").prop("checked", true);
            $(this).html("UNCHECK ALL");
        }else{
            $(".infostock<?php echo $kode_unit; ?>").prop("checked", false);
            $(this).html("CHECK ALL");
        }
    });




Aucun commentaire:

Enregistrer un commentaire