Use event delegation that is disabled by the presence of the class.
var modal = $('#registerModal');
modal.on('click', "#instagram-login-btn:not(.disabled)", function(event) {
});
modal.on("click", "#another_element:not(.disabled)", function(event) {
});
Then, to disable them, add a class disabled.
$("#registerModal *").addClass("disabled");
And remove the class to include.
$("#registerModal *").removeClass("disabled");
This is an add / remove class for all nested elements, but your actual code may be more targeted.
- , .
var modal = $('#registerModal');
modal.on('click', "#instagram-login-btn", function(event) {
});
modal.on("click", "#another_element", function(event) {
});
, ,
$("#registerModal *").on("click", function(event) { event.stopPropagation() });
.
$("#registerModal *").off("click");
, .