0

I am trying to attach a button to link, the link is working fine in google chrome, but its not working in IE and mozilla, is there anything to do about it.

   <button class="button1"><a href="https://cleartax.in/s/gstr2" target="_blank">GSTR-2 RETURN FILING</a></button>
G. Santosh
  • 19
  • 7
  • Don't wrap the link in a `button` tag. `Button` tags have semantic meaning that is overriding your link. – random_user_name Dec 28 '17 at 03:38
  • So how do i have to change code, do i have to end link tag after closing button tag? – G. Santosh Dec 28 '17 at 03:41
  • Why do you even have a `button` tag around your `a` tag? Remove it completely, and use styles / css to make the `a` tag look the way you want it. – random_user_name Dec 28 '17 at 03:56
  • If you want to have a button-link I would suggest to make a link looks like a button. It's a standard approach. There is a good answer about it: https://stackoverflow.com/a/710108/3710672 – Iaroslav Dec 28 '17 at 03:50

1 Answers1

0

Try following way if you no way without button:

<button class="button1" onclick="window.open('https://cleartax.in/s/gstr2')">GSTR-2 RETURN FILING</button>
Hanif
  • 3,739
  • 1
  • 12
  • 18
  • 1
    Ugh. Why resort to javascript just to make a link look like a button? This is **not** the right way to solve this problem. – random_user_name Dec 28 '17 at 04:02
  • Yes I know the best practice as well. Seems he need keep the button as a mandatory for design or DOM manipulation, that's why I not suggested to use link and go his way. Surely my approach also not invalid indeed anyway if you check with validator engine. I just followed the context. – Hanif Dec 28 '17 at 04:08