-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,034
  • 28
  • 94
  • 139

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
  • 857,932
  • 118
  • 1,152
  • 1,264
1

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

desbest
  • 4,601
  • 11
  • 49
  • 80
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,571
  • 25
  • 49