I'm editing a template that includes the use of Switchery plugin to show stylized checkbox.
My project also includes the use of MasterPage.
I need to run code when the state of the checkbox control, and for this reason I have activated the property AutoPostBack = TRUE
Unfortunately, because of the Switcher plugin changes the screen state of the control but does not trigger the event Switchery, I cannot execute code behind.
There is a way to fire event when checkbox change state?
This is my checkbox in asps page:
<asp:CheckBox runat="server" ID="chkModality" data-plugin="switchery" data-color="#f05050" Style="float:left;padding-right:20px" AutoPostBack="true" />
This is javascript code in core.js file
Components.prototype.initSwitchery = function() {
$('[data-plugin="switchery"]').each(function (idx, obj) {
if ($(this).prop("tagName") == "SPAN" && $(this).find("input[type=checkbox]:first").prop("tagName") == "INPUT") {
var chk = $(this).find("input[type=checkbox]");
new Switchery(chk[0], $(this).data());
} else {
new Switchery($(this)[0], $(this).data());
}
});
},
How I can do it?
Aucun commentaire:
Enregistrer un commentaire