$(function () { function removeNote() { $(".remove-note") .off("click") .on("click", function (event) { event.stopPropagation(); $(this).parents(".single-note-item").remove(); }); } function favouriteNote() { $(".favourite-note") .off("click") .on("click", function (event) { event.stopPropagation(); $(this).parents(".single-note-item").toggleClass("note-favourite"); }); } function addLabelGroups() { $(".category-selector .badge-group-item") .off("click") .on("click", function (event) { event.preventDefault(); /* Act on the event */ var getclass = this.className; var getSplitclass = getclass.split(" ")[0]; if ($(this).hasClass("badge-business")) { $(this).parents(".single-note-item").removeClass("note-social"); $(this).parents(".single-note-item").removeClass("note-important"); $(this).parents(".single-note-item").toggleClass(getSplitclass); } else if ($(this).hasClass("badge-social")) { $(this).parents(".single-note-item").removeClass("note-business"); $(this).parents(".single-note-item").removeClass("note-important"); $(this).parents(".single-note-item").toggleClass(getSplitclass); } else if ($(this).hasClass("badge-important")) { $(this).parents(".single-note-item").removeClass("note-social"); $(this).parents(".single-note-item").removeClass("note-business"); $(this).parents(".single-note-item").toggleClass(getSplitclass); } }); } var $btns = $(".note-link").click(function () { if (this.id == "all-category") { var $el = $("." + this.id).fadeIn(); $("#note-full-container > div").not($el).hide(); } if (this.id == "important") { var $el = $("." + this.id).fadeIn(); $("#note-full-container > div").not($el).hide(); } else { var $el = $("." + this.id).fadeIn(); $("#note-full-container > div").not($el).hide(); } $btns.removeClass("active"); $(this).addClass("active"); }); $("#add-notes").on("click", function (event) { $("#addnotesmodal").modal("show"); $("#btn-n-save").hide(); $("#btn-n-add").show(); }); // Button add $("#btn-n-add").on("click", function (event) { event.preventDefault(); /* Act on the event */ var today = new Date(); var dd = String(today.getDate()).padStart(2, "0"); var mm = String(today.getMonth()); //January is 0! var yyyy = today.getFullYear(); var monthNames = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ]; today = dd + " " + monthNames[mm] + " " + yyyy; var $_noteTitle = document.getElementById("note-has-title").value; var $_noteDescription = document.getElementById( "note-has-description" ).value; $html = '
' + today + "
" + '' + $_noteDescription + "
" + "