dstreet / dependsOn

a jQuery plugin for handling form field dependencies
http://dstreet.github.com/dependsOn
MIT License
106 stars 32 forks source link

.or method doesn't work properly on document.ready() #33

Closed decadence closed 8 years ago

decadence commented 8 years ago

Version v1.4.0.

Hello, I found one bug: when I use .or method dependent element is not visible after page load, but it has to be. If I check checkbox manually it works ok.

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>

    <script src="./jquery-3.1.1.min.js"></script>
    <script src="./dependsOn.min.js"></script>

    <script>
        $(function () {

            $("#text").dependsOn({
                "#c1": {
                    checked: true
                }
            }, {}).or({
                "#c2": {
                    checked: true,
                }
            })
        });
    </script>
</head>
<body>

<input checked type="checkbox" id="c1"> 1
<br>
<input  type="checkbox" id="c2"> 2

<input type="text" id="text">

</body>
</html>

If second checkbox is checked, it works fine.

decadence commented 8 years ago

Manually call check method doesn't help too.

decadence commented 8 years ago

@dstreet Thanks! It works fine now.