AbanteCart Community
Shopping Cart Operations => Support => Topic started by: hb007006 on November 30, 2016, 02:43:03 AM
-
Hello,
How can I handle events in jquery or java script while toggling on btn_switch style?
For example when i click on ON i want alert ("hello ON") and when i click on Off I want to alert ("hello OFF")
Thanks
-
I found the way. Than you
-
Hi.
Please post solution. This may help other users. ;)
-
define a switch button in your php like below
$this->data['form']['fields']['abc'] = $form->getFieldHtml(array(
'type' => 'checkbox',
'name' => 'abc',
'value' => 1,
'checked' => false,
'style' => 'btn_switch'
));
Below is the jquery code
jQuery(function ($) {
$("#frmName_abc_layer>button").on('click', function () {
var abc_switcher = $("#frmName_abc");
if(abc_switcher.val() == "0") {
alert('Off');
} else {
alert('On');
}
});
});