Switch is a Grid-compatible Field Type add-on for ExpressionEngine that enables easy either-or switches.
While we have incentive to keep this project working because we use it frequently, we are not always available to provide support for the Switch plugin. We therefore offer it to you, free of charge, but with no guarantee of support. Find something that's not working? Or could be improved? By all means, fix it! Submit a pull request, and we'll pull it into the project so everyone can benefit. But please, no hard feelings if we can't help you when it's not working. Go forth and Open Source.
- EE 2.7
- Copy the "system/expressionengine/third_party/switch" folder to
ExpressionEngine's third-party add-ons directory. (e.g.
/system/expressionengine/third_party/
) - Copy the "themes/third_party/switch" folder to ExpressionEngine's third-
party themes directory. (e.g.
/themes/third_party/switch/
) - Log into your ExpressionEngine control panel.
- Open the Field Types tab.
- Click "Install" by "Switch".
Set "Switch" as the Field Type.
Each Switch field will trigger a custom jQuery event when the user changes the value.
$('#hold_field_7 .switch').on('switchChange', function(e) {
var position = e.switchPosition; // The position of the option (1, 2, ..., 8)
var value = e.switchValue; // The selected option's value
var text = e.switchText; // The selected option's text
var color = e.switchColor; // The selected option's color
});
Switch is distributed under the MIT license. See LICENSE.md for more information.