You are viewing limited content. For full access, please sign in.

Question

Question

Open a link in a new popup window -- opening only first link

asked on April 10, 2019 Show version history

Dear all,

i am using below code to open a link in a new window.

The link is populated by a lookup from my DB.

but the code am using is only opening the first link

can any one help to make code open all links.

 

see code below:

$(document).on("lookupcomplete", function (event) {
  $('.link [type="text"]').each(function(e,el){
   var link=$(el).val();
    var link2=$(el).val();
    
    
  link2= "link"
   
   $(el).replaceWith($('<a ="' + link + ' target="_blank"  id = "test">' + link2 + '</a>'));

 test.onclick = function ShowWindow() { 
   window.open(link, 'popUpWindow', 'height=300,width=600,left=100,top=30,resizable=Yes,scrollbars=Yes,toolbar=no,menubar=no,location=no,directories=no,status=No');
}

  });
  });

 

0 0

Replies

replied on April 10, 2019

It's a little unclear exactly what you are seeing and what you want to happen, but you seem to be mixing two different ways of opening a link in a new window.  Your a tag has target="_blank", which will behave as described in https://www.w3schools.com/tags/att_a_target.asp .  You also have window.open with a window name, which will behave as described in https://developer.mozilla.org/en-US/docs/Web/API/Window/open.  The way you are using them will have different results, though it's not clear what the `test` object is that is having its click handler set.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.