ToggleButton ToggleButton is used to select a boolean value using a button.

Basic

Icons

PrimeElement

<input type="checkbox" name="chk" id="chk1" value="1"/>
                                
$('#chk1').puitogglebutton();
                                
Name Type Default Description
onLabel string yes Label for the on state.
offLabel string no Label for the off state.
onIcon string null Icon for the on state.
offIcon string null Icon for the off state.
style string null Inline style of the element.
styleClass string null Style class of the element.
Name Parameters Description
change event: puitogglebuttonchange event
checked: Boolean value of the state.
Fires when value changes.

Example

            $(':checkbox').puitogglebutton({
                change: function(event, checked) {
                    //..
            }});
                                
Name Parameters Description
check - Selects value.
unselect - Unselects value.
toggle - Toggles checked state.
isChecked - Returns checked state.
enable - Enable the widget.
disable - Disable the widget.
option name: Name of the option Returns the value of the option.
option name: Name of the option, value: Value of the option Set the value of the option.

Example

            $('#default').puitogglebutton('check');  
                                
$(function() {
    $('#basic').puitogglebutton();

    $('#icons').puitogglebutton({
        onLabel: 'I agree',
        offLabel: 'I disagree',
        onIcon: 'fa-check-square',
        offIcon: 'fa-square'
    });
});
                                
<h3 class="first">Basic</h3>
<input id="basic" type="checkbox" />

<h3>Icons</h3>
<input id="icons" type="checkbox" />

<h3>PrimeElement</h3>
<p-togglebutton onlabel="I confirm" offlabel="I reject" onicon="fa-check-square" officon="fa-square"></p-togglebutton>
                                

Usage

ToggleButton is an input element to select a binar value.
<p-togglebutton onlabel="I confirm" offlabel="I reject" onicon="fa-check-square" officon="fa-square"></p-togglebutton>
                                

Attributes

Name Type Default Description
id string null Identifier of the element.
onlabel string yes Label for the on state.
offlabel string no Label for the pff state.
onicon string null Icon for the on state.
officon string null Icon for the off state.
name string null Name of the request parameter to be used in a form submission.
checked boolean false Boolean value to define the state of the element.
onchange function null Name of function to invoke when state of element changes.

Methods

Name Parameters Description
check - Selects value.
unselect - Unselects value.
toggle - Toggles checked state.
isChecked - Returns checked state.
enable - Enable the widget.
disable - Disable the widget.