Ali Zia Ali Zia - 1 year ago 66
Javascript Question

Can I use a <button> instead of <a> to go to #location?

I have this code.

<li class="active">
<a href="#tab-weekly" data-toggle="tab">Weekly Payment</a>
<a href="#tab-advance" data-toggle="tab">Advance Payment</a>
<a href="#tab-data" data-toggle="tab">Expenses</a>

My question is that can I use
instead of
to achieve this? I changed it to buttons but they are not working.

Answer Source

Yes. Use <button type="button" onclick="window.location.href='YOUR URL HERE'">Link Text</button>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download