Solved

jQuery hide() not working

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
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…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now