CheckBox.ValueChanged

Syntax

ValueChanged: function (sender, args)

Parameters

sender. Event source.

args. Event information.

Description

The ValueChanged event occurs on component value change.

Example

To execute the example, connect the PP.js library and the PP.css visual styles tables, add the div element with the CB1 identifier to the page. Create an instance of the CheckBox component. Add the ValueChanged event handler:

<script type="text/javascript">
    var checkbox1 = new PP.Ui.CheckBox({//Create an instance of the CheckBox component
        ParentNode: document.getElementById("CB1"),
        Content: "select"
    });
    checkbox1.ValueChanged.add(function (sender, args) {//Add the  ValueChanged event handler
        var cb1 = checkbox1.getChecked();//Create the variable containing value of the Checked property
        if (cb1 === true)//If the component is selected,
        alert("Right"); //the "Right" message appears    
        //Check if icon is clicked
        if (args.IsImgClick == true) {
            console.log("Icon is clicked");
        } else {
            console.log("Icon is not clicked");
        }
});
</script>

After executing the example, HTML page places the CheckBox component. On selecting the component, the Right message is displayed. On deselecting, the message is not displayed. If the icon was clicked, the console displays the following message:

The icon was clicked

Otherwise:

It was not the icon what was clicked

See also:

CheckBox