Prevent Default Explained in JavaScript | e.preventDefault() - Tutorial For Beginners

preview_player
Показать описание

In this video I take you through an example with a link to the YouTube website and how we can use preventDefault() to disable it. I also create a checkbox which enables/disables the link.

For your reference, check this out:

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
Рекомендации по теме
Комментарии
Автор

Чел, ты объяснил лучше чем весь русский ютуб, хотя и на английском.

You explain better than the whole Russia video youtube, though in on English. My respect!

Постлеброн
Автор

Excellent explanation. Brief and exact. Thank you!

stanciudorin
Автор

thank you for sharing big amount of knowledge in 5 minutes.

abdufattohxamidullayev
Автор

Thank you for the real world case on how/when to use this feature. Light-bulb moment for me

bz
Автор

I have understood the preventdefault method, thanks for understandable explanation.

laszlogyor
Автор

Thank you, very clear explanation. Subscribed

dphov
Автор

a great video indeed, brief and well explained.

almomaiz
Автор

Thank you very much man, very helpul !!!!

domdom
Автор

great video. simple. informative. well explained.

LorneAshley
Автор

Finally got tyhe purpose of this function. I was so confused!

gabrieldoceu
Автор

Hi guys,
why don't we add the end of the add.eventListener(blablabla, {passive:false} for event.preventDefault ?
it works perfectly just i wonder. which conditions we should add passive:false ?

halilibrahimtosun
Автор

Man like Satan Dave in the YT recommendations... This guy knows!

sorrell
Автор

In forms, when putting e.preventDefault() on the onSubmit function, does it not do anything if the form is empty?

paulwong
Автор

prevent default(), prevent default action on links, but why do you put a link if you dont what any action on it ??, can you explain this to me ??

lbrevilation
Автор

Hello, I'm new in JS, Is event.PreventDefault() deprecated ? How would you solve it ? Thks.

anthoneoxprod
welcome to shbcf.ru