Problem
In WordPress at least for custom links, it would be great to allow menu options to open in a new window/tab via the target=”_blank” element in the link tags. Controlling menus in the WP Menu tool is awesome, but many of the sites I work with have external links in the main navigation menus that need to open in a new tab.
Solution
jQuery('a[title="_blank"]').each( function(i) { jQuery(this).attr('target', '_blank'); jQuery(this).attr('title', jQuery(this).text()); } );
Result
<a title=”_blank” href=”http://www2.allegiantair.com/”>Allegiant Air</a>
turns into
<a title=”Allegiant Air” href=”http://www2.allegiantair.com/” target=”_blank”>Allegiant Air</a>