Add and Remove Active Class on Click

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ธ.ค. 2024

ความคิดเห็น • 37

  • @huna7a
    @huna7a ปีที่แล้ว +7

    God, dude, you saved my ass. Im a beginner in javascript and I headbang over this for 3 straight days.

    • @ash_of_hope519
      @ash_of_hope519 7 หลายเดือนก่อน

      What the hell same man :o !

    • @bastian-z9w
      @bastian-z9w 2 หลายเดือนก่อน

      yes i wrote a much more difficult solution last time now i see i can write it much more efficient...i almost thought there must be a simpler solution for this situation cause every website has this feature.

  • @ixtiyaragayev2406
    @ixtiyaragayev2406 ปีที่แล้ว +2

    Thank you so much, No other videos I've watched couldn't solve the problem this clean.

  • @sadique_x_
    @sadique_x_ ปีที่แล้ว +2

    you really saved me about an hour man
    much appreciated

  • @Yunraii
    @Yunraii ปีที่แล้ว +1

    Thank you very much for this. I was complicated myself trying to add something like this on my website but you made it so clear to understand it and the solution itself was way easier than other codes I found on the internet. Much apreciated ❤

  • @PatrycjaOosthuizenCode
    @PatrycjaOosthuizenCode 11 หลายเดือนก่อน +1

    Thank you for this explanation after few days of trying different methods finally I found your channel with perfect solution 🙌

  • @Pharmtechie
    @Pharmtechie 6 หลายเดือนก่อน +1

    Bro thanks a lot
    I have spent more than 5hrs with this.

  • @sebastianlozano7707
    @sebastianlozano7707 ปีที่แล้ว +1

    I spent 2 hours trying to do it man!

  • @anthonyjibueze8413
    @anthonyjibueze8413 10 หลายเดือนก่อน +1

    Thank you for this. Used it on a client website after watching this video.

  • @photoinshot1355
    @photoinshot1355 ปีที่แล้ว +1

    Very clear and precise tutorial and well explained, thanks. I have two nav bars ,top and bottom but this only works either top or bottom depending on which one was clicked anyone with any ideas on how to fix? Pointers welcome

  • @herbiejames5637
    @herbiejames5637 2 หลายเดือนก่อน

    does line 5 make all "active" elements in the document lose "active", or just the navLinkEls?

  • @Ayushsingh-in1si
    @Ayushsingh-in1si ปีที่แล้ว +1

    This tutorial was very helpful, it will be great if you create playlist that includes these kind of videos. I checked on your channel there wasn’t any of them.
    I have done the basics in js like classes, objects, etc. and was struggling with finding these type of tutorials that actually matters. Sadly everyone has made the tutorials on js till basic language and their content is too length, unstructured.
    Please create playlists on your channel it will help new learners allot. 🙏🙏

  • @kalidomar2531
    @kalidomar2531 ปีที่แล้ว +1

    Thank you very much, that was easy and on point.

  • @MadDoxXx_01
    @MadDoxXx_01 ปีที่แล้ว +2

    thanks for tutorial but what when we scroll to different section of page? it doesn't change according to that.

  • @bastian-z9w
    @bastian-z9w 2 หลายเดือนก่อน

    Thanks for the video. Does it work if i have links like and so on? because on reload it will be removed?!

  • @TeeKay-q5f
    @TeeKay-q5f หลายเดือนก่อน

    If i refresh the the page, will it still maintain the current active link?

  • @kurisu26
    @kurisu26 ปีที่แล้ว +1

    Thanks. That single question mark saved me hours. lol

  • @sotorius_27
    @sotorius_27 ปีที่แล้ว +1

    you're the best dude

  • @MuhammadAli-kj9jc
    @MuhammadAli-kj9jc 5 หลายเดือนก่อน

    I am subscribed your channel for this video. it helped to solve my problem

  • @huna7a
    @huna7a ปีที่แล้ว

    How to make it so upon page refresh my first div to become or stay the current active page 😢 its accordion menu related thing i want upon refresh the first div to become the active div if its not already the active div and I want if its the current active div before the refresh to stay the active div after the refresh

  • @piano_izi
    @piano_izi ปีที่แล้ว +1

    God bless you!

  • @Aliena92
    @Aliena92 ปีที่แล้ว +1

    Thank you a lot! How can we do this with tailwind?

  • @mdabdulahallnomantuhin3621
    @mdabdulahallnomantuhin3621 7 หลายเดือนก่อน +1

    Thank you very much brother😊😊😊

  • @SG_Media31
    @SG_Media31 ปีที่แล้ว +1

    Thanks alot 😇😇

  • @saravafaei7708
    @saravafaei7708 ปีที่แล้ว +1

    Awesome ❤

  • @JulioCesar-hh9wq
    @JulioCesar-hh9wq ปีที่แล้ว +1

    Thank you

  • @darkvenom4469
    @darkvenom4469 ปีที่แล้ว

    Awesome this helps me in project thanks

  • @Filmy_Wallah
    @Filmy_Wallah ปีที่แล้ว +1

    After wasting 4hours finally now i do it

  • @paulonivar5678
    @paulonivar5678 ปีที่แล้ว

    I am a little confused here could anybody help me understand the following. A const navLinksEls was created but within the function, navLinksEls is being referred to as navLinksEl without the s at the end how does that work?

    • @mestayno
      @mestayno ปีที่แล้ว +1

      In my understanding he could've named whatever that element. It just means that for each of those elements individually. He could've named it something like element, el, or even rabbit

    • @R3dPeel
      @R3dPeel ปีที่แล้ว

      As Atilla said, you can name it anything but he used navLinksEl to refer to the buttons.

  • @jacoblue5245
    @jacoblue5245 10 หลายเดือนก่อน

    Why use add and remove? Doesn’t “toggle” do the same?

  • @krishnavamsi1126
    @krishnavamsi1126 6 หลายเดือนก่อน +1

    thanks guru

  • @Entertainment.Tube0
    @Entertainment.Tube0 ปีที่แล้ว +1

    awesome...

  • @محمدحمدي-و7ح7ح
    @محمدحمدي-و7ح7ح 10 หลายเดือนก่อน +1

    thanks a lot

  • @Dstoic
    @Dstoic 8 หลายเดือนก่อน +2

    I was putting the dot thats why my code was not working..lol