Search This Blog

Thursday 24 July 2014

HOW TO OPEN LINK IN NEW TAB USING JAVASCRIPT

HOW TO OPEN LINK IN NEW TAB USING JAVASCRIPT

Method 1
function open_in_new_tab(url )
{
  window.open(url, '_blank');
  window.focus();
}
Method 2
 $('a').click(function() {
  $(this).attr('target', '_blank');
 });
Method 3
 $(document).ready(function() {
   $('#NewTab').click(function() {
        $(this).target = "_blank";
        window.open($(this).prop('href
        return false;
   });
});​

#https://codeatelier.wordpress.com/tag/open-link-in-new-tab-jquery/

No comments:

Post a Comment