Skip to content

Snippets / JS

JS

Toggle Switcher Field On by Default

D Donald McGuinn · 185 views · Updated 2 years ago
Add the snippet in an HTML widget on each create page to enable OR add it site wide using Elementor Pro or FluentSnippets to make it site wide. 
document.addEventListener('DOMContentLoaded', function() {
// Get all elements with the class 'onoffswitch-checkbox'
var toggles = document.querySelectorAll('.onoffswitch-checkbox');

// Loop through each toggle and set it to checked
toggles.forEach(function(toggle) {
toggle.checked = true;
});
});
JS · 9 lines

Discussion

Ask a question or share how you used this.

Log in to join the discussion.

No comments yet — be the first.

Voxel Guide assistant
Ask about snippets, addons & how-tos

Hey — how can I help?

I can dig through the library for snippets, addons, and tutorials.

AI can be wrong — double-check anything important.