0

I am having trouble to set this button to pop up a new window. Note that i am using glyphicon button. I am aware of using $window as mention in Open links in new window using AngularJS but i think it is not similar to my case.

  <td class="text-left">
                    <div class="btn-group">
                        <div class="btn"><i class="glyphicon glyphicon-edit"></i></a>
Community
  • 1
  • 1
sue
  • 133
  • 1
  • 1
  • 11

3 Answers3

0

1) I suggest you to use <button class="btn"><i class="glyphicon glyphicon-edit"></i></button> or <a class="btn"><i class="glyphicon glyphicon-edit"></i></a> first.

2) You have some options: 2.a) Add a listener like $('#btn_id').on('click', function() {}); 2.b) Put an onClick attribute inside the <button> or <a> tag

The called function will contain the pop-up configuration.

0

It looks like you start a button using <div class="btn"> but end it with </a>, So these basic html tags do not match with each other. I would use <a class="btn" target="_blank" href="#"> to replace the <div class="btn">.

target="_blank" is the attribute set for hyperlink(<a> tag) to open a new window(tab)

From what I know, Glyphicon is actually not related to pop up new window at all. It is just some nice looking button icons that you can put in html to make you page looks better. The actual part of Glyphicon is <i class="glyphicon glyphicon-edit"></i>. It is just an icon.

To Pop up a new window, you can either choose to use the hyperlink method I provide above, or use the javascript like:

var btns = document.getElementsByClassName('btn');
btns[0].onclick = function(){
    window.open('about:blank');
}

the btns[0] represents the first element of class "btn", and window.open('about:blank') opens a new blank window

lhrec_106
  • 630
  • 5
  • 18
0

Everyone mentioning target="_blank" by wrapping in anchor tag is right, but use class="glyphicon glyphicon-new-window" not edit class.

Rahul R
  • 111
  • 6