CheckedChanged: function (sender, args)
sender. Event source.
args. Information on the event. The IsImgClick argument contains the attribute whether the icon was clicked. If the attribute value is set to True, the icon was clicked, otherwise it is False.
The CheckedChanged event is fired when the state of component selection is changed.
The event is outdated, use the CheckBox.ValueChanged event.
To execute the example, connect the PP.js library and table of PP.css visual styles. Create an instance of the CheckBox component. Add handler for the CheckedChanged event:
<script type="text/javascript"> var checkbox1 = new PP.Ui.CheckBox({//Create an instance of the CheckBox component ParentNode: document.getElementById("CB1"), Content: "select" }); checkbox1.CheckedChanged.add(function (sender, args) {//Add the CheckedChanged 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: