Monday, July 31, 2017

Bagaimana cara menggunakan mask input tanggal

Bagaimana cara menggunakan mask input Tanggal, NPWP, Nomer Telpon lebih mudah dilihat.

Tanggal 
NPWP 
Hasil Mask Tanggal: 31/07/2017
Hasil Mask NPWP: 12-345-678-9-012-345


Berikut ini contoh scriptnya:

<!doctype html>
<html>
    <head>
        <title>Masking Input - www.imagegambar.com</title>
    </head>
    <body>
        <form action="#">
            Tanggal <input name="tgl" id="tgl" /> <br>
            NPWP <input name="npwp" id="npwp" /> <br>
            <input name="submit" type="submit" value="Simpan"/>
        </form>

        <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js'></script>
        <script type='text/javascript' src='https://raw.githubusercontent.com/digitalBush/jquery.maskedinput/1.4.1/dist/jquery.maskedinput.js'><script>

        jQuery(function($){
            $("#tgl").mask("99/99/9999",{placeholder:"mm/dd/yyyy"});
            $("#npwp").mask("99-999-999-9-999-999");
$("#phone").mask("(999) 999-9999");
$("#tin").mask("99-9999999");
$("#ssn").mask("999-99-9999");
        });
        </script>
        <?php
        $tgl = $_REQUEST["tgl"];
        $npwp = $_REQUEST["npwp"];
        echo "<br><br>Hasil Mask Tanggal: ".$tgl;
        echo "<br>Hasil Mask NPWP: ".$npwp;
        ?>
    </body>
</html>

<!--
Source:
http://harviacode.com/2014/12/14/masking-format-input/
http://digitalbush.com/projects/masked-input-plugin/
http://jqueryui.com/

Hasil Mask Tanggal: 31/07/2017
Hasil Mask NPWP: 12-345-678-9-012-345
-->

1 comment:

  1. If some one wants expert view concerning blogging and site-building then i advise him/her to pay a visit this weblog, Keep up the pleasant job. yahoo sign in

    ReplyDelete

How to change label text using Javascript

1. Make the new ID for <label> 2. Loaded first the label element when script is executed.