0

I have added 2 custom buttons in my sweet alert, but the functions for them aren't working, can u advise me a fix for that?

//Custom buttons
html: '<button id="prev-btn" class="btn btn-warning"><i class="fas fa-angle-left fa-3x"></i></button>' +
                    '<button id="next-btn" class="btn btn-primary"><i class="fas fa-angle-right fa-3x"></i></button>',

//Functions for them
$("#next-btn").on("click", function() {
                if(currentMarineKnotIndex+1 == receivedArray.length){
                    currentMarineKnotIndex = 0;
                }
                else{
                    currentMarineKnotIndex++;
                }
                $(".nautical-knot-title").html(receivedArray[currentMarineKnotIndex].nameLV+"<br>");
                $(".nautical-knot-desc").html(receivedArray[currentMarineKnotIndex].descriptionLV);
                $("#modal-header-div").css("background", "url('../Images/uploads/"+receivedArray[currentMarineKnotIndex].Image+"')");

            });
            $("#prev-btn").on("click", function() {
                if(currentMarineKnotIndex == 0){
                    currentMarineKnotIndex = receivedArray.length - 1;
                }else{
                    currentMarineKnotIndex--;
                }
                $(".nautical-knot-title").html(receivedArray[currentMarineKnotIndex].nameLV+"<br>");
                $(".nautical-knot-desc").html(receivedArray[currentMarineKnotIndex].descriptionLV);
                $("#modal-header-div").css("background", "url('../Images/uploads/"+receivedArray[currentMarineKnotIndex].Image+"')");
Renārs
  • 33
  • 5

1 Answers1

0

This link (official site) might be useful -> https://sweetalert.js.org/guides/

Onaapo
  • 112
  • 1
  • 7