Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8228981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:38:37+00:00 2026-06-07T16:38:37+00:00

I wonder whether someone may be able to help me please. Firstly, my sincere

  • 0

I wonder whether someone may be able to help me please.

Firstly, my sincere apologies because I’m not very well versed with JavaScript and some may feel this a foolish post, but any help would be greatly appreciated.

I’m currently using the script below to delete gallery images.

<script type="text/javascript"> 
        Galleria.ready(function() {
            this.$('thumblink').click();

        $(".galleria-image").append( 
        "<span class='btn-delete ui-icon ui-icon-trash'></span>"); 
        $(".btn-delete").live("click", function(){  
        var img = $(this).closest(".galleria-image").find("img"); 
        $.msgbox("You are about to delete this image. It cannot be restored at a later date. Do you wish to continue?", {
        type: "alert",
          buttons : [
            {type: "submit", value: "Delete"},
            {type: "cancel", value: "Cancel"}
          ]
          },
          function(result) {
          if(result)


          // send the AJAX request
          $.ajax({
            url : 'delete.php',
            type : 'post',
            data : { image : img.attr('src'),  idnum: "VALUE", lid: "VALUE"},
            success : function(){
            img.parent().fadeOut('slow');
            }
        });               
    });
        return false;
    });     
});

</script>

I’ve now find a more suitable jQuery confirmation script here which I’d now like to try and implement.

Using the script.js file from this site and my existing script, I’ve tried to combine them and have come up with the following:

<script type="text/javascript"> 
Galleria.ready(function() {
    this.$('thumblink').click();
    $(".galleria-image").append( 
    "<span class='btn-delete ui-icon ui-icon-trash'></span>"); 
    $('.btn-delete').click(function(){
    var elem = $(this).closest(".galleria-image").find('.item'); 
        $.confirm({
            'title'     : 'Delete Confirmation',
            'message'   : 'You are about to delete this item. <br />It cannot be restored at a later time! Continue?',
            'buttons'   : {
                'Yes'   : {
                    'class' : 'blue',
                    'action': function(){
                        elem.slideUp();
                              $.ajax({
                                url : 'delete.php',
                                type : 'post',
                                data : { image : img.attr('src'),  idnum: "VALUE", lid: "VALUE"},
                                success : function(){
                                img.parent().fadeOut('slow');
                                }
                            }); 

                    }
                },
                'No'    : {
                    'class' : 'gray',
                    'action': function(){}  // Nothing to do in this case. You can as well omit the action property.
                }
                }
                }
            }
        });

    });

});
</script>

The problem I’m having is that although the page loads, it doesn’t load in the default Gallery image format, and the trash icon which I use as a visual trigger to delete the image has disappeared at the bottom of each image.

I’ve gone into the JavaScript Console and the error it shows is:Uncaught SyntaxError: Unexpected token }highlighting this line in my code as the problem: $.confirm({ but I have to be honest and say I’m not really sure what this means.

I’ve tried quite a few variations of changing the code around to try and get this to work, unfortunately without success.

I just wondered whether someone could possibly take a look at this please and provide some guidance on where I’m going wrong.

Many thanks and kind regards

Working solution

<script type="text/javascript"> 
Galleria.ready(function() {
this.$('thumblink').click();
$(".galleria-image").append( 
"<span class='btn-delete ui-icon ui-icon-trash'></span>"); 
$('.btn-delete').click(function(){
var img = $(this).closest(".galleria-image").find('img'); 
    $.confirm({
        'title'     : 'Delete Confirmation',
        'message'   : 'You are about to delete this item. <br />It cannot be restored at a later time! Continue?',
        'buttons'   : {
            'Yes'   : {
                'class' : 'blue',
                'action': function(){
                    //elem.slideUp();
                          $.ajax({
                            url : 'delete.php',
                            type : 'post',
                            data : { image : img.attr('src'),  idnum: "VALUE", lid: "VALUE"},
                            success : function(){
                            img.parent().fadeOut('slow');
                            }
                        }); 

                }
            },
            'No'    : {
                'class' : 'gray',
                'action': function(){}  // Nothing to do in this case. You can as well omit the action property.
                 }
               }
            });
        });
    });
    </script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T16:38:39+00:00Added an answer on June 7, 2026 at 4:38 pm

    You are missing some braces, It cant be really solution to the problem but first check with this code, I have formatted with necessary braces and let us know your findings:

    Galleria.ready(function() {
    this.$('thumblink').click();
    $(".galleria-image").append( 
    "<span class='btn-delete ui-icon ui-icon-trash'></span>"); 
    $('.btn-delete').click(function(){
    var elem = $(this).closest(".galleria-image").find('.item'); 
        $.confirm({
            'title'     : 'Delete Confirmation',
            'message'   : 'You are about to delete this item. <br />It cannot be restored at a later time! Continue?',
            'buttons'   : {
                'Yes'   : {
                    'class' : 'blue',
                    'action': function(){
                        elem.slideUp();
                              $.ajax({
                                url : 'delete.php',
                                type : 'post',
                                data : { image : img.attr('src'),  idnum: "VALUE", lid: "VALUE"},
                                success : function(){
                                img.parent().fadeOut('slow');
                                }
                            }); 
    
                    }
                },
                'No'    : {
                    'class' : 'gray',
                    'action': function(){}  // Nothing to do in this case. You can as well omit the action property.
                     }
                   }
                });
            });
        });
    

    Also Your success callfunction is missing data parameter

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder whether someone may be able to help me please. Firstly, apologies because
I wonder whether someone may be able to help me please. Firstly apologies, because
I wonder whether someone may be able to help me please Firstly, my apologies
I wonder whether someone may be able to help me please. Firstly apologies as
I wonder whether someone may be able to help me please. Firstly, my apologies
I wonder whether someone may be able to help me please. Firstly my apologies.
I wonder whether someone may be able to help me please. Firstly, apologies, I'm
I wonder whether someone may be able to help me please. Firstly, this is
I wonder whether someone may be able to help me please. I'm using the
I wonder whether someone may be able to help me please. I feel I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.