Solved

jQuery hide() not working

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

911 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

20 Experts available now in Live!

Get 1:1 Help Now