mercredi 30 décembre 2015

Javascript function doesn't work on uncheck the check box

   <html>
    <head>
        <title>Test</title>
<script type="text/javascript" src="http://ift.tt/1EjeICQ"></script>
    </head>
    <body>

    <button id="check_box" onclick="check_box();"> check box </button>
    <br> <br>
    <input type="checkbox" id="checkboxF1" class="css-checkbox"> Test

    <script>
    $('#checkboxF1').on('change', function() {
  alert("test"); 
});

    function check_box(){
        document.getElementById("checkboxF1").checked = true;   
    }

    </script>

    </body>
    </html>

This onchane function work while check the checkbox directly. but it doesn't work when check the checkbox through a function ie function name check_box(). i want to work the onchange function while check the checkbox even it check through a function( 'check_box()' ).




Aucun commentaire:

Enregistrer un commentaire