Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 268941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:45:40+00:00 2026-05-11T23:45:40+00:00

I am using jQuery, and wish to make certain links open in a new

  • 0

I am using jQuery, and wish to make certain links open in a new window.

However, I want to pass as valid XHTML 1.1. Also, I beleive this is a behaviour which should be in the correct layer, i.e. JavaScript.

Any jQuery plugin available?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T23:45:41+00:00Added an answer on May 11, 2026 at 11:45 pm

    I’ve thrown together a quick jQuery plugin

     (function($){  
      $.fn.newWindow = function(options) {       
        var defaults = {
            titleText: 'Link opens in a new window'     
        };
    
        var options = $.extend(defaults, options);
    
         return this.each(function() {  
           var obj = $(this);
    
           if (options.titleText) {        
               if (obj.attr('title')) {
                         var newTitle = obj.attr('title') + ' (' 
                                                    + options.titleText + ')';
               } else {
                        var newTitle = options.titleText;
               };              
               obj.attr('title', newTitle);            
           };          
    
           obj.click(function(event) {
              event.preventDefault();  
              var newBlankWindow = window.open(obj.attr('href'), '_blank');
              newBlankWindow.focus();
            });     
           });    
      };  
     })(jQuery); 
    

    Example Usage

    $('a[rel=external]').newWindow();
    

    You can also change, or remove the title text, by passing in some JSON options

    Example to change title text:

    $('a[rel=external]').newWindow( { titleText: 'This is a new window link!' } );
    

    Example to remove it alltogether

    $('a[rel=external]').newWindow( { titleText: '' } );
    

    This is my first jQuery plugin, so any feedback would be greatful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wish I can make an image gallery without using jQuery plugin. Which all
Using jQuery I want to bind an existing function to a button. I've been
Using jQuery UI 1.8rc3 combined with the new jquery.effects.fade.js code, I've been able to
I am trying to implement a type of slider using jquery. However this question
I am dynamically appending HTML to a webpage and I'm also using jQuery to
I am using the jQuery plugin 'formwizard' and wish to allow users to jump
I am using a div whose dimensions are set using jquery, but i wish
I wish to determine using jquery or javascript that is the user has switched
I am showing lots of form using jquery dialog and I wish to add
I wish to, using JQuery, show and hide some anchor tags as I hover

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.