Henry Bishop
Henry Bishop

Reputation: 7

javascript causing 2nd pop up window to occur?

I'm using this javascript once a user has clicked submit on a html form. What I am trying to achieve is have a jquery window pop up. However, whilst it does do this, the browser is also opening up a new _blank target window at the same time and I don't want it to do this.

Is there a way to stop this so I only have the one jquery "shadowbox" window coming up?.

<script>
    $(document).ready(function() {
        $('#myform').submit(function() {
            Shadowbox.open({
            content:    '<iframe src="loginin.php" width="500" height="300" scrolling="no" style="overflow:hidden; border:none;"></iframe>',
            player:     "html",
            height:     300,
            width:      500
        });

        this.target = 'formpopup';
    });
});
</script>

Upvotes: 1

Views: 90

Answers (1)

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324630

Setting this.target = "formpopup" is telling the form to submit to a new window/tab named "formpopup". Remove that line, and cancel the event instead.

Upvotes: 2

Related Questions