Blankit for jQuery – set your targets to blank.

The latest addition to my ever growing list of projects on Github is Blankit – a jQuery plugin for adding target=”_blank” to any matching elements. This was done to avoid the issue of creating a long, content heavy, page and having to go through and manually add target=”_blank” to each a element. This plugin was also contributed to by Seb Pollard, the technical ninja that he is.

Check it out: on github or try out the demo.

The plugin takes 3 options allowing you to customize it to suit your needs; same domain links can be included as can list elements, and previously set target attributes can be overridden.

How to use

[box icon="code"]

$ ( “a” ).blankit( { option: value } );

[/box]

Options

[box icon="code]
// Any previously set targets will be overridden with the new _blank value.
override: (default: false)

// This will include any anchor tags that are in a list (usually menu element).
listitems: (default: false)

// This will include/exclude the internal links from having blank set as a target property.
samedomain: (default: false)
[/box]

Check it out & tell me your thoughts. Don’t forget you can also fork it and use it however you want. There is also more information on the plugin at plugins.jquery.com

[line]

If you enjoyed this post, why not subscribe to my feed or check me out on Twitter.

 

2 Responses to Blankit for jQuery – set your targets to blank.
  1. Manoj Reply

    I think the base tag in html will do that.

    will open all the links in a html page in a new window.

Leave a Reply

Your email address will not be published. Please enter your name, email and a comment.

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>