How to Create Reusable Buttons — HTML, CSS & JavaScript Tutorial

preview_player
Показать описание
In today's video, I'll show you how to build a function in JavaScript that you can reuse to build as many buttons as you need for your application. Once built, you can append these buttons to existing containers or other HTML elements.

Google Material Symbols 👇

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!

#dcode #javascript #webdevelopment
Рекомендации по теме
Комментарии
Автор

you deserve more views and subscribes in this 3 years...

iqronegoro
Автор

Nice one Dom! An excellent example of "Separation of Concerns".
I use the same approach myself to generate (see below) complex forms with loads of input and output fields, custom dropdowns etc. but a learned some useful things from your video.

I agree that JSDoc is very helpful in this case because you get type hints in VS Code in vanilla JS.

If you take this one step further you can use a (simple) generator to create complex forms. My "source" is an Excel sheet with all the elements and their attributes (including _dynamic_ type checking).
I convert the Excel sheet to a JS object which is included in the app bootstrap and starts the form generator (html template based) which typically takes about 250 ms. I admit it is
a bit of an DYI approach but I find it very useful for complex forms (50+ elements) that need frequent updates.

All the best,
Ed

montebont
Автор

Hi Dom,
Love your approach and trying to extend it to checkboxes, radio(group)s, etc. However, with a lot of questions . ., some examples . .
- jQuery, React, (Underscore) do similar things but became too complicated for a simple (frontend) website.
- "CSS / JS - Only" Youtube Channels have become more and more popular compared to the above mentioned.
- But, but . . you are thinking of expanding this way of programming. --:) that might mean thousands (I'm an optimist) of personal libraries with web-components that will never be re-used. So ...
- Can you please make / propose some guidelines or preferences as part of your series?
Thanks, Benny

bennybrouwer
Автор

Hello Dom,
Could you do other videos for other components ? It would be great to have a lightweight js framework 😅

mrkvnnn
Автор

Can you do a tutorial on JSDoc please?

Dexterx
Автор

Will it work without the js doc or typescript?

Robdunnhill
join shbcf.ru