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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:58:32+00:00 2026-06-02T20:58:32+00:00

My current script is a little broken. Clicking on the link in the table

  • 0

My current script is a little broken. Clicking on the link in the table successfully creates my div overlay. Then I close my div and click on another link and the div overlay opens again the close button stops working.

I’m guessing the problem is that that DOM doesn’t recognize my empty divs again after I use “replaceWith”.

Any help would be appreciated.

<table id="tableBin" border="0">
    <tr>
        <th>name</th>
        <th>description</th>
    </tr>
<tbody>
    <tr>
        <td><a href="clip/location/A001C012_111129_R1VL.mov">A001C012_111129_R1VL.mov</a></td>
        <td>Adipiscing elit. Fusce bibendum, leo non.</td>
    </tr>
    <tr>
        <td><a href="clip/location/A001C012_111130_R1VL.mov">A001C012_111130_R1VL.mov</a></td>
        <td>Consectetur adipiscing elit. Fusce bibendum, leo non.</td>
    </tr>
</tbody>

</table>

<div id="overlay">
    <div id="blackOut" class="hide">
        <div id="box" class="hide">
            <div id="controls" class="hide"><a href="#"><img border="0" alt="close" width="25px" hieght="25px" src="images/close.png"></a></div>
        </div>
    </div>
</div>

<script>
    $("#tableBin a").on("click", function(e) {
        e.preventDefault();
        var url = $(this).attr("href");
        var video = jQuery('<embed width="640" height="375" ShowControls=1 src="'+url+'" /></embed>');

        $('#blackOut').removeClass("hide").addClass("blackOut");
        $('#box').removeClass("hide").addClass("box");
        $('#controls').removeClass("hide").addClass("controls");
        $('#box').append(video);
    });
</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-02T20:58:35+00:00Added an answer on June 2, 2026 at 8:58 pm

    This seems to work:

    http://jsfiddle.net/aramk/WesNb/2/

    $(document).ready(function () {
        $("#tableBin a.video").click(function(e) {
                e.preventDefault();
                var url = $(this).attr("href");
                var video = $('<embed width="640" height="375" ShowControls=1 src="'+url+'" /></embed>');
    
                $('#overlay').removeClass("hide");
                $('#blackOut').removeClass("hide").addClass("blackOut");
                $('#box').removeClass("hide").addClass("box");
                $('#controls').removeClass("hide").addClass("controls");
                $('#video-container').removeClass("hide").html(video);
            });
    
            $("#close-button").click(function(e) {
                $('#overlay').addClass("hide");
                $('#video-container').addClass("hide").html("");
                return false;
            });
    });
    ​
    

    I wasn’t sure if you wanted to replace the playing video or not, so I’ve added a container which has its contents replaced with the loaded video on each click.

    Also, your original code replaced everything when close was clicked – this is very destructive and unmaintainable. Changing anything in the HTML would mean changing everything in the JS – in a string – which is very messy.

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

Sidebar

Related Questions

I have the following script that successfully retrieves the current track and updates my
I have a little script that shows a div when an arrow is clicked.
Can anyone help me with reversing this PHP page navigation? Current script setting shows
Possible Duplicate: get name of current PHP script in include file Can an included
What is current directory of shell script? Is this current directory from which I
I wanted to run a script in the location of the current buffer, or,
hi I'm writing a script to loop through the current directory and list all
I created a script that list the directories in the current directory <?php $dir
I have an IronPython script that looks for current running processes using WMI. The
Is there a javascript script that returns the current html of the window? 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.