Monday, June 29, 2009

[jQuery] Re: Problem with popup windows in jquery

Yes... that should work :X

On Jun 29, 3:56 pm, brian <bally.z...@gmail.com> wrote:
> Why don't you just put that code in the head of the popup page?
>
> On Mon, Jun 29, 2009 at 8:11 AM, Joao Portela<agno...@gmail.com> wrote:
>
> > Hi, I'm trying to use jquery to modify some events in a popup window
> > (window.open). Here's what I did;
>
> > var popup = window.open('Example.html',
> >                'Example',
> >                'height=400,width=300,top=100,left=100');
>
> > $(popup.document).ready(function() {
> >        $("#widget-area a", popup.document).click(function() {
> >                alert("Clicked!");
> >        });
> > });
>
> > And here's the stripped down html code of the page:
>
> > <form method = "post" id = "myForm" onsubmit="return handleWidget();">
> >        Select a Widget:
> >        <div class = "widget-area">
> >                <a href = "#" >Click Me</a>
> >        </div>
> >        <input type="submit" value="Submit"/>
> > </form>
>
> > The popup window shows up, but the click event doesn't work (doesn't
> > show the alert)... If I only use this:
>
> > $(popup.document).ready(function() {
> >        alert("Ready!");
> > });
>
> > It properly shows the message. The problem is with $("#widget-area a",
> > popup.document).click(function() { ... });
>
> > Thanks for your help,
>
> > João Portela

No comments: