www.webdeveloper.com
Results 1 to 3 of 3

Thread: Open URL in new tab/window with .click()

  1. #1
    Join Date
    Jan 2011
    Posts
    2

    Open URL in new tab/window with .click()

    Hi,

    I have the following code:

    Code:
    $(".buy_icon").click(function () {
          window.location = "http://www.theuntappedsource.com/results.php?category=422"
        });
    which loads the URL in the current browser window when the div (buy_icon) is clicked.

    How can I load the URL in a new tab or window?

    Thanks for any help you can offer
    Dan

  2. #2
    Join Date
    Jan 2011
    Posts
    2
    I worked it out in the end:

    Code:
     $('.buy_icon').click(function() {
       window.open('http://www.theuntappedsource.com/results.php?category=422');
          });

  3. #3
    Join Date
    Dec 2002
    Location
    St. Louis, MO, USA
    Posts
    1,582
    Untested, but replace "window.location" with "window.open". Don't forget to include a window name and the parameters.

    ^_^

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles