Don’t use JS for that - Part 1

Don’t use JS for that - Part 1

Kevin Powell

1 год назад

109,203 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@dog4ik
@dog4ik - 28.11.2023 02:32

in reality you just dont render element

Ответить
@justme3393
@justme3393 - 07.06.2023 10:52

And this is why Kevin is the best

Ответить
@aidennelson3171
@aidennelson3171 - 28.04.2023 19:02

May God bless, very nice!

Ответить
@insearchof9090
@insearchof9090 - 06.04.2023 08:27

Yes, yes CSS Pope

Ответить
@sauravkattel2429
@sauravkattel2429 - 06.04.2023 08:17

Why is css becoming more complex then JavaScript?😂😂

Ответить
@lewisone
@lewisone - 04.04.2023 03:39

You are truly the King of CSS. Enjoy your throne King.

Ответить
@sahildas.
@sahildas. - 26.02.2023 22:35

What is Little Girl's middle name, Plus, you are the best! Edit: What's the code anyways

Ответить
@jfbcodes
@jfbcodes - 18.02.2023 04:06

This video is epic.

Ответить
@thedigitalceo
@thedigitalceo - 11.02.2023 04:58

Omg!! Had no idea css could do this

Ответить
@brunosupico2385
@brunosupico2385 - 03.01.2023 00:41

Interesting but if it’s coded with an JS librairie like react, JavaScript is simplier

Ответить
@BobbyBundlez
@BobbyBundlez - 02.01.2023 02:31

i spent an hour yesterday writing functions for capitalizing words, then found the equality of data not being the same cuz i capitalized some variables and not the others.. then realized I could have just literally capitalized in the css. fucking retard moment to say the least

Ответить
@shaded4438
@shaded4438 - 01.01.2023 06:55

Not sure that's great for screen readers? Just remove the excess mark up from the dom

Ответить
@incarnateTheGreat
@incarnateTheGreat - 31.12.2022 10:11

When you zoomed in on the "Little Girl" part, I laughed. Thank you.

Ответить
@stemlund
@stemlund - 30.12.2022 00:43

This makes me wonder what the best approach would be when I'm using WordPress and custom fields to display content. I usually use PHP if/else statements to only show html/field content if the field has data/content, otherwise show nothing. Now I wonder if this CSS option is better.

Ответить
@sinom
@sinom - 28.12.2022 21:37

Very bad idea to do it too broad. You'll often WANT empty elements for styling so using a very specific selector instead is probably actually the best option

Ответить
@uridevmedia803
@uridevmedia803 - 27.12.2022 18:36

This is cool kevin

Ответить
@jhona1429
@jhona1429 - 26.12.2022 22:48

Stop making my job easier!

Ответить
@soul1543
@soul1543 - 25.12.2022 20:42

Orrrr you build your app in php, problem solved easy

Ответить
@sayeddileri3461
@sayeddileri3461 - 25.12.2022 16:22

I just learn’t this today!!!

Ответить
@amans6504
@amans6504 - 25.12.2022 09:16

We surely have messed up with so much of javascript that makes the websites slow. Writing pure css is very satisfying

Ответить
@nicolastoledo8366
@nicolastoledo8366 - 23.12.2022 21:58

BUENÍSIMO

Ответить
@ek1g
@ek1g - 22.12.2022 00:23

or you just remove that snippet.

Ответить
@KunglawAdy
@KunglawAdy - 21.12.2022 14:08

Next css will can do logic

Ответить
@alarii2582
@alarii2582 - 21.12.2022 00:23

Thank you for this video. JS is WAY too overused these days

Ответить
@jshstuff
@jshstuff - 20.12.2022 23:39

Please make this an ongoing series. There are so many cases where people reach for JS when there are way better ways to accomplish easily with CSS

Ответить
@SheikhAmeen
@SheikhAmeen - 20.12.2022 19:41

Great, but still seems like it's JavaScript's job do that. Let CSS do the styling, let JavaScript handle logic of whether to render it or not based on the value. Sure this technique may come in handy for some other scenarios.

Ответить
@user-lq7xz1th4x
@user-lq7xz1th4x - 20.12.2022 13:44

You're the best

Ответить
@momikshrestha6085
@momikshrestha6085 - 20.12.2022 10:16

Kids fault not mine. Stoopid child needs to get a job.

Ответить
@spuryaas
@spuryaas - 20.12.2022 07:43

Wow, it's incredibly simple and very useful! Before this i was having to make "if" statements in my templates to properly remove empty elements, but now it's mush more simple

Ответить
@imadulting
@imadulting - 20.12.2022 05:52

Didn't know about the empty selector

Ответить
@qwertt14
@qwertt14 - 20.12.2022 00:57

Or you can, you know, not render the empty element in the first place

Ответить
@TheLollercaster
@TheLollercaster - 19.12.2022 20:23

Based on my experience, in real life, you wouldn't solve this issue with JavaScript

Ответить
@tabiasgeehuman
@tabiasgeehuman - 19.12.2022 15:59

I would love to know how to make a good 0 JS drop-down. It would be nice to have

Ответить
@truvc
@truvc - 18.12.2022 11:46

I wish any browsers supported the way the empty selector is supposed to match elements with only white space.

Ответить
@kris_wav
@kris_wav - 18.12.2022 11:31

🎶for now🎶

Ответить
@yavuz1695
@yavuz1695 - 18.12.2022 06:00

It is very counter intuitive though... not everyone thinks of looking up css for such behavior. Personally i would still prefer JS for this

Ответить
@belonggame
@belonggame - 17.12.2022 18:24

That"s a nice way to solve. But I guess, that's validation problem for me. I would either put a regex pattern to the imput to prevent it or add the role class conditionally. But then again it's less code to write 🤷‍♂️

Ответить
@faizanullah9400
@faizanullah9400 - 17.12.2022 08:58

❤👐

Ответить
@ruyvieira104
@ruyvieira104 - 17.12.2022 07:56

Just don't "render" the element

Ответить
@oliverreviews8496
@oliverreviews8496 - 17.12.2022 00:12

You must be an idiot to put some of your business logci onto frontend....
Better to do it on be as replacement, much more efficient
(That's not about the autrhor of the vid :), it's great)

Ответить
@ichiroutakashima4503
@ichiroutakashima4503 - 16.12.2022 20:25

This makes me want to NOT learn JS and just focus on HTML and CSS instead, lol.

Ответить
@EverydayJavaScript
@EverydayJavaScript - 16.12.2022 19:14

You are just amazing!!!

Ответить
@sasd570
@sasd570 - 16.12.2022 18:33

great introduction for little girl

Ответить
@emuemhonjieonosereme2495
@emuemhonjieonosereme2495 - 16.12.2022 13:41

Thank you 😊

Ответить
@jethrolarson
@jethrolarson - 16.12.2022 05:22

Break unexpected things with this one simple trick!

Ответить
@triteraerlangga7917
@triteraerlangga7917 - 15.12.2022 23:23

Nice! New knowledge! Thanks Kevin

Ответить
@EverRusting
@EverRusting - 15.12.2022 23:12

Or just don't put a p there, well, I get that this has other applications

Ответить
@salimal-tarsha5564
@salimal-tarsha5564 - 15.12.2022 22:42

Man i love you , you share every important small detail for free ...
You're amazing

Ответить
@koin9583
@koin9583 - 15.12.2022 22:35

Good solution to a bad design

Ответить