Solved

jQuery hide() not working

Posted on 2011-09-06
4
273 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

695 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