Add Remove Active Class On Click - Html CSS and Javascript

  Рет қаралды 222,689

Online Tutorials

Online Tutorials

Күн бұрын

Also Watch This : Add Remove Active Class Based On URL Using Javascript only
Video Url : • Add Remove Active Clas...
------------------
Enroll My Course : Next Level CSS Animation and Hover Effects
www.udemy.com/...
------------------
Join Our Channel Membership And Get Source Code Everyday
Join : / @onlinetutorialsyt
------------------
Please LIKE our Facebook page for daily updates...
/ online-tutorial-html-c...

Пікірлер: 125
@OnlineTutorialsYT
@OnlineTutorialsYT 4 жыл бұрын
Watch This : Add Remove Active Class Based On URL Using Javascript only Video Url : kzbin.info/www/bejne/eHqWnIGpideojdE
@adolfomartin5456
@adolfomartin5456 4 жыл бұрын
I think you should have made this with "pure JavaScript", with querySelectorAll. And to code toggle classes there is a method that I cannot remember right now.
@aweaweee430
@aweaweee430 3 жыл бұрын
Thx for reduce my headache
@shubhampodhade7653
@shubhampodhade7653 4 жыл бұрын
Thank you for informative. Non copied video. Useful.
@malamehta6991
@malamehta6991 2 жыл бұрын
Thank you for this video ..it's really help me for solving my issue ☺️☺️
@kriziacarissepangan1590
@kriziacarissepangan1590 2 жыл бұрын
Woaah! Thanks for this! God bless!
@aburayhan6149
@aburayhan6149 2 жыл бұрын
this video is really great.... it's help me ...thank you so much bro🥰🥰
@MohitKumar-jg4ry
@MohitKumar-jg4ry 2 жыл бұрын
Thanks a lot, it helps me more. I use many methods, and in the end, this helps me! thanks again👍
@frogsama666
@frogsama666 5 жыл бұрын
I think i'm starting to have feelings for you
@emirbyte
@emirbyte 3 жыл бұрын
Wtf
@bo_ver4628
@bo_ver4628 5 жыл бұрын
Your tutorials is great! But it will be much amazing if you use pure vanilla javascript)
@anselminos5238
@anselminos5238 5 жыл бұрын
i want vanilla because i wanna learn vanilla js
@blakereeves3900
@blakereeves3900 5 жыл бұрын
Just use DOM manipulation instead of jQuery. It will look very similar.
@anselminos5238
@anselminos5238 5 жыл бұрын
@@blakereeves3900 yeah its something like document.getElementById("Element").classList.add/remove("Class")
@OnlineTutorialsYT
@OnlineTutorialsYT 4 жыл бұрын
Watch This : Add Remove Active Class Based On URL Using Javascript only Video Url : kzbin.info/www/bejne/eHqWnIGpideojdE
@meezanmallick5908
@meezanmallick5908 4 жыл бұрын
That background music and simple code made me stress-free
@sorbangsorrysorrybangbang7388
@sorbangsorrysorrybangbang7388 2 жыл бұрын
Thank you so much sir
@VivekKumar-bc4mj
@VivekKumar-bc4mj 2 жыл бұрын
This is tutorial video is so helpful ❤️❤️
@ziauddinbablu1814
@ziauddinbablu1814 3 жыл бұрын
Thanks. it was very helpful for me.
@manuelsuarezabascal75
@manuelsuarezabascal75 6 жыл бұрын
First liked the video and then watch it! Excellent as usual!
@sayonjana
@sayonjana 2 жыл бұрын
great one sir
@bhaveshasnotkar5210
@bhaveshasnotkar5210 4 жыл бұрын
Video is upto the point.. Wonderful liked it
@ardeleangavril-liviu3549
@ardeleangavril-liviu3549 4 жыл бұрын
It works only because you didn't added href If you do add a link to another page it will reload the script and the Home page will still have the class active. I even tried to make the navbar in a separate folder and add it to each page with php code "require" and I still get same result. Am I doing something wrong?
@tiagofilipe1308
@tiagofilipe1308 3 жыл бұрын
did you manage to solve?
@ManishSharma-zd3iq
@ManishSharma-zd3iq 2 жыл бұрын
great man , thanks
@danutzz8
@danutzz8 3 жыл бұрын
cheers m8--- great video and works perfect! I was only after the removal of the active state from siblings ;)
@abbasawa372
@abbasawa372 5 жыл бұрын
Thankyou for saving my time buddy (y)
@bhupengadtia
@bhupengadtia 6 жыл бұрын
First to view first to comment.. Thanks for the tutorial
@gauravbadgujar5555
@gauravbadgujar5555 5 жыл бұрын
Thank you Sirji. It's a nice video. It helps me a lot. Thanks :)
@separatetraveler8226
@separatetraveler8226 6 жыл бұрын
Excellent . by the way ..Thanks.
@quynhphan4402
@quynhphan4402 5 жыл бұрын
Thanks for your video.
@roti1873
@roti1873 5 жыл бұрын
5:41 bookmark - full code
@zafarasrorov3687
@zafarasrorov3687 3 жыл бұрын
thanks man
@maheranam318
@maheranam318 2 жыл бұрын
Wow his intro is literally the background score from "The Social Network"
@mehedihasannabil6485
@mehedihasannabil6485 3 жыл бұрын
thanks man, it's working.
@MrWebDesignerAnas
@MrWebDesignerAnas 3 жыл бұрын
I want this in vanilla javascript please
@raedkais4891
@raedkais4891 3 жыл бұрын
Than you!
@gxguy2906
@gxguy2906 4 жыл бұрын
Will this work during page reload?
@muhammadsofyansyah9571
@muhammadsofyansyah9571 4 жыл бұрын
not working
@syedashahjaffery7044
@syedashahjaffery7044 3 жыл бұрын
great tutorial
@syedashahjaffery7044
@syedashahjaffery7044 3 жыл бұрын
thank you sir
@user-qo6vg5jb6y
@user-qo6vg5jb6y 2 жыл бұрын
Last Part not working->where you are adding siblings().removeClass('')😞
@infernal95mailru
@infernal95mailru 3 жыл бұрын
Thanks!!
@Jake-im8eq
@Jake-im8eq 3 жыл бұрын
For some reason the JS code doesnt change the active class for me. Do you know why?
@iindgren
@iindgren Жыл бұрын
same here, did you solve it?
@hirenajudiya2923
@hirenajudiya2923 5 жыл бұрын
thanks.......bro
@hasanmashriqi7997
@hasanmashriqi7997 4 жыл бұрын
thanks a lot. nice
@ranjankaw3414
@ranjankaw3414 3 жыл бұрын
when we put the href attribute values like some website link this active class will not work. It will initially highlight the anchor link and then the active css will go away when page is redirected. Any idea how to solve this problem ?
@OnlineTutorialsYT
@OnlineTutorialsYT 3 жыл бұрын
Solution : kzbin.info/www/bejne/eHqWnIGpideojdE
@prasantasaha7556
@prasantasaha7556 3 жыл бұрын
You could use the flexbox to align everything.
@create4makingplaylist280
@create4makingplaylist280 3 жыл бұрын
nice! thank you
@tuannguyen-xd1yg
@tuannguyen-xd1yg 4 жыл бұрын
thank you
@VishalSoni-pn5mk
@VishalSoni-pn5mk 4 жыл бұрын
thanks
@techshab9060
@techshab9060 6 жыл бұрын
Superb sir
@crocronson7908
@crocronson7908 2 жыл бұрын
what is this awesome music?
@3APPutil
@3APPutil 3 жыл бұрын
Mt gostoso ver esse video com essa musica
@EscOfficial
@EscOfficial 4 жыл бұрын
THANK YOUUUUU
@akremhammami5328
@akremhammami5328 4 жыл бұрын
is there pure javascript alternative solution ?
@OnlineTutorialsYT
@OnlineTutorialsYT 4 жыл бұрын
Watch This : Add Remove Active Class Based On URL Using Javascript only Video Url : kzbin.info/www/bejne/eHqWnIGpideojdE
@anuragsrivastava6598
@anuragsrivastava6598 5 жыл бұрын
Can you provide with the code?
@syediqbalahmed3176
@syediqbalahmed3176 5 жыл бұрын
thanks...
@zholy9
@zholy9 6 жыл бұрын
Just asking ... but is it possible that this isn't the "universal" way of how to add/remove class via JS? With the use of "siblings" - I think it's only limited to the "same elements" (in this case "ul li"). But would this work on just "divs, img" as well ? Again, just asking, as I'm rubbish in JS.
@OnlineTutorialsYT
@OnlineTutorialsYT 4 жыл бұрын
Watch This : Add Remove Active Class Based On URL Using Javascript only Video Url : kzbin.info/www/bejne/eHqWnIGpideojdE
@iamgod3724
@iamgod3724 3 жыл бұрын
Javascript or jQuery ??
@janaojana1686
@janaojana1686 3 жыл бұрын
it doesn't work. why?
@osmanylmaz9535
@osmanylmaz9535 4 жыл бұрын
Thank you
@bhupendrashekhawat9185
@bhupendrashekhawat9185 3 жыл бұрын
why dont you use toggle ?..
@wednesday6301
@wednesday6301 4 жыл бұрын
this jQuery sir, i need pure js.
@OnlineTutorialsYT
@OnlineTutorialsYT 4 жыл бұрын
Watch This : Add Remove Active Class Based On URL Using Javascript only Video Url : kzbin.info/www/bejne/eHqWnIGpideojdE
@alyssajorgensen3279
@alyssajorgensen3279 4 жыл бұрын
@@OnlineTutorialsYT Thank you very much for that link
3 жыл бұрын
how do you fetch wich one is active?
@pranavanand2281
@pranavanand2281 2 жыл бұрын
haunted background music
@businesssocho2246
@businesssocho2246 Жыл бұрын
How to add a class on dynamically created element
@tarashrunyk9491
@tarashrunyk9491 4 жыл бұрын
Hi, can you tell me for what you add position: relative to “a” element ?
@corsiniRicardo
@corsiniRicardo 4 жыл бұрын
instead of 'ul li' you put 'ul li a'
@prasantasaha7556
@prasantasaha7556 3 жыл бұрын
Listen relative is a way of positioning an element. Relative to its previous position. But absolute is quite different. ITS POSITIONED RELATIVE TO ITS DIRECT PARENT.
@tommyzDad
@tommyzDad 4 жыл бұрын
I was hoping for a pure/ vanilla javascript solution.
@OnlineTutorialsYT
@OnlineTutorialsYT 4 жыл бұрын
Watch This : Add Remove Active Class Based On URL Using Javascript only Video Url : kzbin.info/www/bejne/eHqWnIGpideojdE
@amitsinghrajput7057
@amitsinghrajput7057 6 жыл бұрын
Bro home page pe slider ki jgah pe 3 short videos ko ek saath kaise lgaynge iska video bnao
@laibaiqbal3784
@laibaiqbal3784 3 жыл бұрын
why people do not add source code :/
@monozoid
@monozoid 4 жыл бұрын
why i cant change color
@jonayethossain6672
@jonayethossain6672 6 жыл бұрын
nice
@Deeepakk_kumar
@Deeepakk_kumar 6 жыл бұрын
Sir i need your help on responsive navigation bar please help me
@helmas_witch
@helmas_witch Жыл бұрын
Why it doesn't work? X((
@codeek0
@codeek0 Жыл бұрын
OM!
@serenamatla5712
@serenamatla5712 4 жыл бұрын
it's not working
@mayursaroj4360
@mayursaroj4360 5 жыл бұрын
make a video on effect where when you click an unactive element the background from active element slides to the clicked element....i dont know what its called... please reply
@OnlineTutorialsYT
@OnlineTutorialsYT 4 жыл бұрын
Watch This : Add Remove Active Class Based On URL Using Javascript only Video Url : kzbin.info/www/bejne/eHqWnIGpideojdE
@mohammadzakirhossain2428
@mohammadzakirhossain2428 4 жыл бұрын
you just show how to do anything by using js but you don't show that why?
@guilhermealexander4855
@guilhermealexander4855 3 жыл бұрын
teach to do with Javascript
@chinmoymandal9669
@chinmoymandal9669 5 жыл бұрын
Sir I have faced some problem while using this code...whenever I navigate to another link it will not work....so please do something...
@ZenelJashari
@ZenelJashari 5 жыл бұрын
same here, if you don't assign a page but only with hashtag (#) it works. Once you assign a page like "contat.aspx" it wont work
@OnlineTutorialsYT
@OnlineTutorialsYT 4 жыл бұрын
Watch This : Add Remove Active Class Based On URL Using Javascript only Video Url : kzbin.info/www/bejne/eHqWnIGpideojdE
@arslmirza8642
@arslmirza8642 3 жыл бұрын
site py nahi chalti jab page reload hota hai
@OnlineTutorialsYT
@OnlineTutorialsYT 3 жыл бұрын
kzbin.info/www/bejne/eHqWnIGpideojdE
@ronqs
@ronqs 5 жыл бұрын
How do you do this with css only?
@tronicuganda1560
@tronicuganda1560 4 жыл бұрын
Man. If u redirects to page it won't work 🙄
@OnlineTutorialsYT
@OnlineTutorialsYT 4 жыл бұрын
try this : kzbin.info/www/bejne/eHqWnIGpideojdE
@SAGskills
@SAGskills 4 жыл бұрын
ho w r u my page going refresh after click on menu li where is the problem?
@hinajain8529
@hinajain8529 3 жыл бұрын
Hey did you find the solution to this problem? I am facing the same problem
@OnlineTutorialsYT
@OnlineTutorialsYT 3 жыл бұрын
Yes...please watch this kzbin.info/www/bejne/eHqWnIGpideojdE
@junaeidahmed6344
@junaeidahmed6344 2 жыл бұрын
Javascript title dikha kar jquery dekha rahe ho wah
@almostworthy2973
@almostworthy2973 4 жыл бұрын
so jquery and JS are brothers??
@OnlineTutorialsYT
@OnlineTutorialsYT 4 жыл бұрын
Watch This : Add Remove Active Class Based On URL Using Javascript only Video Url : kzbin.info/www/bejne/eHqWnIGpideojdE
@santacroce2489
@santacroce2489 4 жыл бұрын
song?
@yeasinjabed3630
@yeasinjabed3630 4 жыл бұрын
Plz help me , How can i addclass with page load
@OnlineTutorialsYT
@OnlineTutorialsYT 4 жыл бұрын
Watch This : Add Remove Active Class Based On URL Using Javascript only Video Url : kzbin.info/www/bejne/eHqWnIGpideojdE
@corsiniRicardo
@corsiniRicardo 4 жыл бұрын
siblings().removeClass() is not doing his job
@darkrems3872
@darkrems3872 5 жыл бұрын
not working
@OnlineTutorialsYT
@OnlineTutorialsYT 4 жыл бұрын
Watch This : Add Remove Active Class Based On URL Using Javascript only Video Url : kzbin.info/www/bejne/eHqWnIGpideojdE
@muneebgamer6351
@muneebgamer6351 5 жыл бұрын
code?
@OnlineTutorialsYT
@OnlineTutorialsYT 4 жыл бұрын
Watch This : Add Remove Active Class Based On URL Using Javascript only Video Url : kzbin.info/www/bejne/eHqWnIGpideojdE
@periksi
@periksi 5 жыл бұрын
Nome da música?
@game_developer_7382
@game_developer_7382 5 жыл бұрын
Skylike - Dawn
@periksi
@periksi 5 жыл бұрын
@@game_developer_7382 valeui
@game_developer_7382
@game_developer_7382 5 жыл бұрын
@@periksi I didn't understand you
@periksi
@periksi 5 жыл бұрын
@@game_developer_7382 thank you
@periksi
@periksi 5 жыл бұрын
@@game_developer_7382 valeu/obrigado is thank you in portuguesh
@CodeSplash
@CodeSplash 2 жыл бұрын
Vanilla Javascript Way -------> const li = document.querySelectorAll( 'li' ); li.forEach( currLi => { currLi.addEventListener( 'click' , (e) => { e.target.parentElement.querySelector( '.active' ).classList.remove( 'active' ); e.target.classList.add( 'active' ); }); });
@himalayagupta7744
@himalayagupta7744 4 жыл бұрын
Thank you so much
@dineshasekar6918
@dineshasekar6918 3 жыл бұрын
Thanks Bro.
Responsive Navigation Bar Tutorial | HTML CSS JAVASCRIPT
35:05
developedbyed
Рет қаралды 1,4 МЛН
Add Remove Active Class Based On URL Using Javascript | No jQuery
3:55
Online Tutorials
Рет қаралды 65 М.
ПРИКОЛЫ НАД БРАТОМ #shorts
00:23
Паша Осадчий
Рет қаралды 4,4 МЛН
مسبح السرير #قصير
00:19
سكتشات وحركات
Рет қаралды 11 МЛН
Fake watermelon by Secret Vlog
00:16
Secret Vlog
Рет қаралды 14 МЛН
How To Make Drop Down Menu Using HTML And CSS | HTML Website Tutorials
21:24
You Don't Need JavaScript For This - CSS ONLY Infinite Scroll
23:35
Slaying The Dragon
Рет қаралды 108 М.
Add and Remove Active Class on Click
5:20
ByteGrad
Рет қаралды 39 М.
Bootstrap 4 Responsive Navigation Bar | Sticky Navbar Html CSS and jQuery
10:01
Navbar CSS Tutorial: 3 Ways to Create a Navigation Bar with Flexbox
15:08
Every CSS Animation property
9:26
chunkydotdev
Рет қаралды 68 М.
Active Nav Link Indicator with Vanilla Javascript
5:56
Coding in Public
Рет қаралды 119 М.
Animate from display none
21:55
Kevin Powell
Рет қаралды 157 М.
Learn CSS dropdown menus in 6 minutes! 🔻
6:36
Bro Code
Рет қаралды 90 М.