lundi 28 novembre 2016

Not able to use "onclick" and "onchange" functions while using custom checkboxes

When using customized checbox (i.e., icheck v1.0.1 from the website http://ift.tt/1VqAPUw), i am not able to use the "onclick" and "onchange" functions that i create manually. I have to use the custom "ifClicked" and "ifChanged" functions that the plugin provides.

Here is my code:-

<!DOCTYPE html>
<html>
<head></head>
<body>
<div id="divchkBox">
  <input type="checkbox" id="extEmailChk" name="custEmailChkBox" onchange="foo()"/><br />

</div>
<script>
    function foo(){
        alert("hi");
    }
</script>
</body>
</html>

But the "foo" function doesn't get called. I have to use the custom "ifChanged" function.

<script>

    $('#divchkBox input').on('ifClicked', function (event) {
         alert("hi");
    });
</script>

I have tried to add the "onclick","onchange" functions in many ways but nothing works.

Can someone help?




Aucun commentaire:

Enregistrer un commentaire