Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Welcome to devrant
I do that quite often because you can give properties more easily to a div than a button -
iema858y@RazorSh4rk Thanks!
I forgot to mention that the button needs to link to another page. It's a news site so we really need to pay attention to semantics. -
Benji-dev198yMy go to tag is <span> personally. I avoid <button> because of it's resistance to styling and avoid <a> because I don't want to bother with event.preventDefault(). But this is of course only when I'm using JavaScript click events. Who would have thought 'onclick' would make a comeback?
-
Benji-dev198y@norman70688
Any inline js is actually uncool, because it's mixing functionality and page structure, thus reducing ease of maintainability.
Except now we have React and JSX :)
Tightly coupling and inlining javascript within the view has come back around. Which is why I was joking onclick has made a comeback ;)
didn't say you couldn't style it, I just said it was more resistant to styling than say, a span.
When I'm prototyping, I can quickly make a button using a span tag on the fly like so: http://codepen.io/anon/pen/...
Notice how the actual button element is resistant to the same styling? To properly style the button cross-platform/browser I need to do something like this: https://codepen.io/terkel/pen/...
which I can't do from memory so yeah, I just don't unless I'm already using a css framework or existing styles that do that already.
I know all about semantics and accessibility. that's why we have 'role': https://goo.gl/nuP0Sk -
Benji-dev198y@jacojvvdev except now it does nothing. If I want have some kind of js handler for that link, I might as well put the function there and prevent the default behavior as the first line of that function.
-
@Benji-dev I only use it when building spas, not everywhere.
Everythig has a right place to be used. -
Benji-dev198y@jacojvvdev I mostly build SPAs. I just assumed that it would interfere with an event listener or an onclick handler that actually handles to logic of the button but maybe not? I guess depends on the framework as well.
-
It's really problematic that some devs don't want or take the time to learn about new technologies and good practises.
It's another problem that there are many ways to solve such problems and many different opinions on what is best practise.
My teammate used p tag and made it look like a button using css.
He has 10 years of web development experience.
undefined