Solved

jQuery hide() not working

Posted on 2011-09-06
4
269 Views
Last Modified: 2012-06-27
I have a window which pops up using tb_show("New Window", url, null);

When a button is clicked, I call a function defined in parent window and then get rid of the pop-up.
The parent window function in turn pops up same dialog.  The problem is for the user, it looks like the dialog stays in place, perhaps with a wired blink.  I want the dialog to actually reappear.

Here is the code currently in place:

In parent window:

openPopup();

Also tried:

setTimeout(openPrevAddrPopup(), 5000); - no effect

In Pop-up window:

function openPrevAddrPopup() {
        var url = "#TB_inline?height=300&width=600&inlineId=MyDivID";  
        tb_show("Previous Address", url, null);      
    }  

Function for button click:

function rerunRequest() {
    //debugger
        $(this).hide();
        parent.focus();
        ShowBlockUI('Searching Database');
        SearchInsuredCreditScore(prevAddress);
        HideBlockUI();
        //window.tb_remove(); -- using tb_remove() does not allow re-open same dialog
        parent.$(this).remove();
    }

ShowBlockUI and HideBlockUI are just customizations for jquery BlockUI plugin used throughout the application.

Thank you.
0
Comment
Question by:Mare22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 36489887
please give a link to see your page
0
 

Author Comment

by:Mare22
ID: 36490379
leakim971,

Thank you for response.  I can't legally share a link here.  Is there anything you could suggest to try?
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 250 total points
ID: 36490790
this look strange for me (in bold) :

function rerunRequest() {
    //debugger
        $(this).hide();

I'm not sure you're able to use $(this) in this context.
Remove class to any previous visible object, for example we use the class "poppa"

$(".poppa").removeClass("poppa");

Open in new window


now when you show a popup you add the poppa class to the object just before displaying it :

$(this).addClass("poppa");

Open in new window


and you should be able to use the class anywhere to hide the right object :

function rerunRequest() {
    //debugger
        $(".poppa").hide();
// we don't forget to remove the class
        $(".poppa").removeClass("poppa");

Open in new window


0
 
LVL 82

Assisted Solution

by:hielo
hielo earned 250 total points
ID: 36490825

Also tried:
setTimeout(openPrevAddrPopup(), 5000); - no effect
If that is what you actually tried, then it will never work because the first argument needs to be a function REFERENCE, not a function call. So, get rid of the parentheses after penPrevAddrPopup:

setTimeout( openPrevAddrPopup, 5000); - no effect

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question