Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click event? #222

Open
docmcfly opened this issue Mar 7, 2020 · 1 comment
Open

Click event? #222

docmcfly opened this issue Mar 7, 2020 · 1 comment

Comments

@docmcfly
Copy link

docmcfly commented Mar 7, 2020

Hello,

IMHO: I personally find this "change" event handling a bit complicated. Wouldn't it be possible for a switch to trigger a "click" on the checkbox?

Then you could simply use the onclick event in the tag.

i have modify the toggle function:

Toggle.prototype.toggle = function () {
		if (this.$element.prop('checked')) this.off()
		else this.on()
		this.$element[0].click()  // <- triggers the onclick event of the <input> tag :)  
	}

Best regards
Clemens

@gobido
Copy link

gobido commented Dec 26, 2021

this is nice, I couldn't place actions in this toggle until I see this post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants