Live data from Hacker News

You might not need JavaScript

youmightnotneedjs.com

71–80 of 254 posts

Re: You might not need JavaScript

#72
post #66

You might not, but you probably do. The validation examples and input types are a case in point. Even on browsers where they work, the alerts can't be styled and the behaviors can't be controlled.

The form element type is perfectly enough for frontend validation. You should do the rest on the backend anyway.

I don't get where the popup ( when you don't match the pattern) in the form example is coming.

Is it from the browser? Can someone explain?

Re: You might not need JavaScript

#73
post #66

You might not, but you probably do. The validation examples and input types are a case in point. Even on browsers where they work, the alerts can't be styled and the behaviors can't be controlled.

The form element type is perfectly enough for frontend validation. You should do the rest on the backend anyway.

When submitting a form with an incorrect pattern in Firefox, the validation behavior highlights the relevant textbox in red for a second, and removes its contents. This default behavior gives a very poor user experience.

Re: You might not need JavaScript

#74
post #65

You might nod near internet, heck, you many not need staying alive, but here we are. Seriously, after some minimum complexity the ability to create functions and loops its extremely important. As in you don't need a spoon and a knife to feed yourself, but it sure fucking helps.

You can also read the title as: You Might Not Need JavaScript for that specific thing.

If this simplifies the codebase, and gives a more uniform user experience, it's harder to argue against.

Re: You might not need JavaScript

#75
CSS is great, and by all means use it, while also being aware that you can build so many functional UI components without the additional dependancy.

Maybe you can include a few lines of utility code, or a mixin, and forgo the requirement. If you're only targeting more modern browsers, you might not need anything more than what the browser ships with.

This site is fully copied from youmightnotneedcss.com, an excellent resource for vanilla CSS created by @somebody and @somebodyelse. But this time, we take a look at the power of modern native HTML and g as well as some of the syntactic sugar of DuJour. Because, you might not need scripts for that task at all! (Note: these methods can all be accessible, but the demos may not be. Please take a moment to test these before using in production)

Re: You might not need JavaScript

#79
post #57

You might not, but you probably do. The validation examples and input types are a case in point. Even on browsers where they work, the alerts can't be styled and the behaviors can't be controlled.

> the alerts can't be styled and the behaviors can't be controlled It's not clear to me whether that's a problem. Isn't consistent UI a good thing? Isn't it faster to fill the forms correctly if alerts always appear in the same way?

How is it consistent UI when it doesn't match your design and looks and works very different in every browser?
Post reply on HN