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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:52:58+00:00 2026-06-17T15:52:58+00:00

I have a jquery function below when when an upload has been completed, it

  • 0

I have a jquery function below when when an upload has been completed, it will store the name of the file in a string and it’s id in a text input. Now at bottom of function, if the user clicks on the deletevideofile button, then it is suppose to remove the file name and the textinput which belongs to that remove button. But problem is that even thought it removes the correct file name only, it removes all text inputs rather than just removing the correct text input.

My question is how can I only remove the correct text input only when the remove button is clicked?

Below is code:

function stopVideoUpload(success, videoID, videofilename){

      var result = '';
      videocounter++;

      if (success == 1){
         result = '<span class="videomsg'+videocounter+'">The file was uploaded successfully</span>';
          $('.listVideo').eq(window.lastUploadVideoIndex).append('<input type="text" name="vidid" value="' + videoID + '" />');
          $('.listVideo').eq(window.lastUploadVideoIndex).append('<div>' + htmlEncode(videofilename) + '<button type="button" class="deletefilevideo" video_file_name="' + videofilename + '">Remove</button><br/><hr/></div>');      }

  var _videocounter = videocounter;

$('.listVideo').eq(window.lastUploadVideoIndex).find(".deletefilevideo").on("click", function(event) {
    var video_file_name = $(this).attr('video_file_name');

    jQuery.ajax("deletevideo.php?videofilename=" + video_file_name)
        .done(function(data) {

        $(".videomsg" + _videocounter).html(data);
    });

       $(this).parent().siblings('input[name="vidid"]').andSelf().remove();
});


      return true;   
}
  • 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-17T15:52:59+00:00Added an answer on June 17, 2026 at 3:52 pm

    In addition to generating the input boxes with the name “vidid”, add an id attribute to the <input> element with a unique ID for every video.

    Then change the selector in your .siblings() function in your .remove() line to match the id of the <input> that’s being generated.

    Here’s some example JavaScript. Modify it to fit your needs:

    function stopVideoUpload(success, videoID, videofilename) {
    
        var result = '', _videocounter;
        videocounter++;
    
        if (success == 1) {
            result = '<span class="videomsg'+videocounter+'">The file was uploaded successfully</span>';
            $('.listVideo').eq(window.lastUploadVideoIndex).append('<input type="text" name="vidid" id="'+videoID+'" value="' + videoID + '" />');
            $('.listVideo').eq(window.lastUploadVideoIndex).append('<div>' + htmlEncode(videofilename) + '<button type="button" class="deletefilevideo" data-videoID="'+videoID+'"  data-video_file_name="' + videofilename + '">Remove</button><br/><hr/></div>');
        }
    
        _videocounter = videocounter;
    
        $('.listVideo').eq(window.lastUploadVideoIndex).find(".deletefilevideo").on("click", function(event) {
            jQuery.ajax("deletevideo.php?videofilename=" + $(this).attr('data-video_file_name')).done(function(data) {
                $(".videomsg" + _videocounter).html(data);
            });
    
            $(this).parent().siblings('#'+ $(this).attr('data-videoID')).andSelf().remove();
        });
    
    
        return true;   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this javascript, jquery function, (below) It gets the text inside each table
I want to have a jquery function that will be activated when any checkbox
I have a jQuery click function below where it appends a selected value from
I have an HTML form with an input field to upload a file. I
I have a jquery that has first server function call using post and next
I have a simple jQuery function--detailed below-- that I'm using to manipulate the position
I'm trying to use the jQuery-File-Upload plugin . But I have a problem when
i have a problem with jquery form plugin. I try to upload a file
I have file input fields in a group like below. I'd like all of
I have a jQuery function I am calling with the below code. The function

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.