Toggle Switcher Field On by Default

Description/Instructions

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. 

If this snippet helped, feel free to buy me a taco :)

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
Copy Code

Let's Chat About this Snippet