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 7928319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T19:41:58+00:00 2026-06-03T19:41:58+00:00

how to remove last comma ‘ , ‘ with jquery. Below is my code

  • 0

how to remove last comma ‘ , ‘ with jquery. Below is my code jquery for slideshow image background ,php code will loop image url in javascript, mean user can change image in admin :

                navigation              :   1,      //Slideshow controls on/off
                thumbnail_navigation    :   1,      //Thumbnail navigation
                slide_counter           :   1,      //Display slide numbers
                slide_captions          :   1,      //Slide caption (Pull from "title" in slides array)
                slides                  :   [       //Slideshow Images
                                                <?php    // this will looping  image background custom - xx_rusly_xx
                                                    $images = getFieldOrder('background_slideshow_image');
                                                        foreach($images as $image){
                                                            echo "{image : '";
                                                            echo get('background_slideshow_image',1,$image);
                                                            echo "'},";
                                                        } 
                                                ?>
                                            ]                           
            }); 
        });

    </script>

If u see i put some php code for loop image url

<?php    // this will looping  image background custom - xx_rusly_xx
$images = getFieldOrder('background_slideshow_image');
    foreach($images as $image){
        echo "{image : '";
        echo get('background_slideshow_image',1,$image);
        echo "'},";
    } 
?>

and browser will generate javascript with php like this :

//Components
        navigation              :   1,      //Slideshow controls on/off
        thumbnail_navigation    :   1,      //Thumbnail navigation
        slide_counter           :   1,      //Display slide numbers
        slide_captions          :   1,      //Slide caption (Pull from "title" in slides array)
        slides                  :   [       //Slideshow Images
        {image : 'http://iconcept-project.com/dev/gd/wp-content/files_mf/1.jpg'},
        {image : 'http://iconcept-project.com/dev/gd/wp-content/files_mf/2.jpg'},
        {image : 'http://iconcept-project.com/dev/gd/wp-content/files_mf/3.jpg'},
        {image : 'http://iconcept-project.com/dev/gd/wp-content/files_mf/4.jpg'},                                                                                                                   ]                           
    }); 
});         
</script>

and the problem is how to remove comma in last line, because with internet explorer this will not run except i remove the last comma.

{image : 'http://iconcept-project.com/dev/gd/wp-content/files_mf/4.jpg'},

here is full code –> http://pastebin.com/c1A7ZKGr

thanks for help.

  • 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-03T19:42:00+00:00Added an answer on June 3, 2026 at 7:42 pm

    I’m curious. Why don’t you do that in PHP side?

    <?php    // this will looping  image background custom - xx_rusly_xx
    $images = getFieldOrder('background_slideshow_image');
        foreach($images as $ind => $image){
            echo "{image : '";
            echo get('background_slideshow_image',1,$image);
            echo "'}".($ind == count($images)-1 ? '' : ','); // no comma for last image
        } 
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new in PHP I want to remove last comma of a string,
Possible Duplicate: Removing last comma in PHP? Remove the last Comma from a string
How to remove part of a string after last comma in PHP ? String
I need help in how to remove the last comma from this looped var,
How can we remove last comma from a comma seperated list in SQL query?
How can I remove last line in a file in iOS. Below is the
How do I remove the last two chars from each line in a text
How do I remove the last character of a string if its a letter.
I need to remove the last character if the textfield length exceeds 100,I used
I can add and remove the last line in my dynamic form and calculate

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.