I need to find out how to use a class that I add as a selector in jquery after I add the class. So essentially when I change a daterange with the ID #ds_i it adds a class to a button and when that button is pressed I will get a pop up. The code I have so far is as follows.
$("#ds_i").on('change', function(){
$( "#save-button" ).addClass( "sweet-date-pop" );
});
$(".sweet-date-pop").click(function(e,params) {
var localParams = params || {};
if (!localParams.send) {
e.preventDefault();
}
swal({
title: "This job is in progress.",
text: "Are you sure you would like to change the dates?",
type: "warning",
showCancelButton: true,
confirmButtonClass: "btn-warning",
confirmButtonText: "Yes,change dates!",
closeOnConfirm: false,
closeOnCancel: false
}, function(isConfirm){
if (isConfirm) {
$(e.currentTarget).trigger(e.type, {'send': true});
} else {
swal("Cancelled", "Nothing Was Changed", "error");
}
});
});