LCweb-ita / LC-switch

Superlight vanilla javascript plugin improving forms look and functionality

Home Page:https://lcweb.it/lc-switch-javascript-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

onclick event

xgregg opened this issue · comments

Sometimes there are differences between setting the state programmatically (eg on initialization) and setting the state on click. My application sets the initial state based on values from database but I need to change it based on parameters. The problem is that there is only one event so I can not distinguish between them.
Any easy way to agregate an onclick event?

commented

There are API functions to manage statuses on the fly.
After your software sets the check status, just use a little script like this one:

($('input').is(':checked')) ? $('input').lcs_on() : $('input').lcs_off();