-1

Is it possible to add an internal link (bookmark/jumpto) on a <button>

<button class="btn span3" id="save_progress" name="save_progress" value="1">Save Changes</button>
acctman
  • 4,229
  • 30
  • 98
  • 142

3 Answers3

2

You can link to any element you like. Just give the element an id and set the URL to #that_id.

If you want to link from something, use a real link. It is what links are designed for. They do it really easily (and natively, and in a screen reader and search engine friendly fashion). If you want to link from something that looks like a button, then use a link and apply CSS to make it look like a button.

If you really, really want to use a button (hint: don't). Then you can bind JavaScript to it:

document.querySelector('#my_button').addEventListener('click', function (event) {
    location = "#my_id";
});
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
1

Yes it is possible. Internal links don't have to point to an anchor tag.

desbest
  • 4,746
  • 11
  • 51
  • 84
0

you could use JavaScript to do something like that onclick="document.location+='#goToAnchor';return false;"

Doesn't seem like the best practice though.

NooBskie
  • 3,761
  • 31
  • 51