Reputation: 10809
I have seen it said that the distinction between anchors and input buttons is obvious. Often on simple webforms it's indeed pretty cut and dried. But when working with web applications, often a link (ie direct forwarding to another page) makes more sense as a button and sometimes it's not clear what something ought to be.
Following the basis of applications, where basically any command that does anything (moving to another screen, saving work, getting help etc) is a button.
There's the practical consideration of using anchors that don't redirect the user to another page seeming strange; but is it better to call javascript from an anchor element?
Often buttons in web-apps are nested in li items, and in stackoverflow notice the 'Ask Question' button/link is in a list even though it's the only item (I assume this is to grab the correct styling).
What options and considerations should I take into account in coding the html element side of things for an interactive JS app?
Upvotes: 0
Views: 177
Reputation: 16139
IMO, anchors are for when you are moving to a different screen, especially if you are going to update the URL hash to enable back button support. So if the action is to view an item, or go to the edit page, etc. use a link.
Otherwise for actions such as 'delete', 'save', 'cancel' etc. I would use buttons.
Upvotes: 1