# Other Languages > jQuery >  object required error when closing a popup

## Bill Crawley

Hi All,

I have some popups that are created via CSS on my page using Div's. One of the popups also has Tab's made up of divs with some JQuery thrown in to hop from 1 tab to the next. all of this works fine accept for when I go to closeany of the popups, the code attempts to run my JQuery again (for some reason) and then the code crashes with object required.
This is my JQuery:


```
$('ul.tabNavigation').each(function () {
            // For each set of tabs, we want to keep track of
            // which tab is active and it's associated content
            var $active, $content, $links = $(this).find('a');

            // If the location.hash matches one of the links, use that as the active tab.
            // If no match is found, use the first link as the initial active tab.
            $active = $($links.filter('[href="' + location.hash + '"]')[0] || $links[0]);
            $active.addClass('active');
            $content = $($active.attr('href'));

            // Hide the remaining content
            $links.not($active).each(function () {
                $($(this).attr('href')).hide();
            });

            // Bind the click event handler
            $(this).on('click', 'a', function (e) {
                // Make the old tab inactive.
                $active.removeClass('active');
                $content.hide();

                // Update the variables with the new link and content
                $active = $(this);
                $content = $($(this).attr('href'));

                // Make the tab active.
                $active.addClass('active');
                $content.show();

                // Prevent the anchor's default click action
                e.preventDefault();
                
            }); 
        });
```

and this is a typical div for my lightbox:


```
<div id="examples" class="white_content">
         <asp:ImageButton class="closeright" ID="ImageButton3" runat="server" ImageUrl="../Images/closeX.png" AlternateText="close" ToolTip="Close" onclientclick="javascript:document.getElementById('examples').style.display='none';document.getElementById('fade').style.display='none';" />
         <p class="lightbox_title">Can I see some examples?</p>
         <div class="exampleTab lightbox_text">
            <ul id="questions" class="tabNavigation">
                <li><a href="#Tab1">Example1</a></li>
                <li><a href="#Tab2">Example2</a></li>
                <li><a href="#Tab3">Example3</a></li>
                <li><a href="#Tab4">Example4</a></li>
            </ul>
            <div id="Tab1">.....
```

The very first time in (page load) the JQuery function gets run and is fine. when I press the imagebutton to close the popup, the JQuery function error's with object required.

----------

