JavaScript Tutorial For Beginners #36 - Changing CSS Styles

JavaScript Tutorial For Beginners #36 - Changing CSS Styles

Net Ninja

8 лет назад

93,395 Просмотров

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


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

@arskeliss6931
@arskeliss6931 - 22.09.2022 14:08

Hi NetNinja! I have a question, can I change CSS style changing it with textContent instead of .style property? Like add for example: backgroundColor = "limegreen"; using textContent instead of style = "background-color: limegreen"?

Ответить
@nelsonantonio5870
@nelsonantonio5870 - 10.12.2021 20:14

Awesome!

Ответить
@ahmedabubakr5510
@ahmedabubakr5510 - 26.09.2021 05:51

Thanks man

Ответить
@kavindurathnasiri5907
@kavindurathnasiri5907 - 10.09.2021 11:40

If you have a video on that question, please tell me

Ответить
@kavindurathnasiri5907
@kavindurathnasiri5907 - 10.09.2021 11:39

But I wanted change CSS after pressing a button

Ответить
@ayaan3429
@ayaan3429 - 19.07.2021 23:57

Am getting uncaught typeerror cannot set property display of undefined when I use :
todo.style.display='flex';
I used querySelector to get the div and stored it in const todo.
Where am I going wrong??? Please help me please... I've been stuck on this for the past 10 days.. am going crazy.

Ответить
@tymothylim6550
@tymothylim6550 - 12.06.2021 10:47

Thank you very much for this video! It was really clear and helpful! Great to see how it shows how Javascript converts the properties with "-" (e.g. background-color) to camel case. Didn't know that till now! :)

Ответить
@lancer7344
@lancer7344 - 21.01.2021 23:00

Big Ninja

Ответить
@barenyakumar9282
@barenyakumar9282 - 15.12.2020 11:54

sir, setAttribute cannot be used for a class? if no what is to be used to change the styles. As I am getting a constant error as class.setAttribute(my defined function) is not a function... you have only told about ids

Ответить
@rishengopaldass1103
@rishengopaldass1103 - 14.08.2020 15:08

You are worthy of your title, "The Net Ninja"

Ответить
@riiad
@riiad - 20.06.2020 13:18

My only question is THANK YOU

Ответить
@vincecaruso6465
@vincecaruso6465 - 03.06.2020 15:55

just a small comment (as I don't think it can be fixed), but the last several video when you're typing it can't be seen because it below the bottom of the screen. Still thumbs way up (because it doesn't let me click it 2x) for great explanations.

Ответить
@eswarb2014
@eswarb2014 - 25.04.2020 10:17

Thanks lot...

Ответить
@ahmedelmawrdy4381
@ahmedelmawrdy4381 - 17.01.2020 23:28

thanks a lot , just i have question , could you recommend me a book for a js

Ответить
@AAAAGGGH310
@AAAAGGGH310 - 28.09.2019 19:27

how to dynamically change css file using javascript ?????

Ответить
@markbalazo1914
@markbalazo1914 - 29.09.2018 05:51

Couldn't thank you enough Sir!

Ответить
@aaronharris1153
@aaronharris1153 - 04.08.2018 07:05

You have made me feel so much more confident man about JavaScript, I'm pretty good at Html/Css(steady improving), have always been really afraid I couldn't understand the logic of JavaScript, thank you so much man!

Ответить
@kaushikprasad3419
@kaushikprasad3419 - 01.04.2018 23:55

great 👌

Ответить
@magnificantW
@magnificantW - 31.08.2017 11:44

thank you this is a very helpful video

Ответить
@kamrantv1206
@kamrantv1206 - 11.08.2017 08:49

how to give hover style in js
also how to fix parentelement undefined problem

Ответить
@Lbmaniak
@Lbmaniak - 01.08.2017 16:34

You are awesome.
At last, I understand JS.
Quickly and simply, this is that what i needed

Ответить
@toastom
@toastom - 28.07.2017 19:44

Net Ninja just makes these videos as an excuse to teach us and do some development of his website at the same time XD

Ответить
@VinceLee911
@VinceLee911 - 29.05.2017 13:42

For adding classes instead of replacing them, we can use

title.className += " " + "your_class_name_here"

The space preceding is important because js concatinates it with the previous class

Ответить
@UTprema
@UTprema - 01.05.2017 23:01

Thanks for the clear short tutorials. What would be a practical use for this? Apart from changing elements in the console window?

Ответить
@pitouchki
@pitouchki - 23.02.2017 03:26

Best net ninja teacher ever. JS so simple thanks to u. THANK YOU

Ответить
@doobiesoda3873
@doobiesoda3873 - 05.01.2017 07:14

I had been beating my head up against a rock trying to comprehend the basics of JS and your channel helps tremendously. Thank you! And lovely accent.

Ответить
@Marinakulichok
@Marinakulichok - 24.10.2016 15:09

super tutorials-- THANK YOU

Ответить
@eahofer
@eahofer - 30.08.2016 11:47

When viewing the "text" list for style, the property is referenced as "background-color," but when setting the attribute it's camel cased without a hyphen (which is logical as attribute names cannot have hyphens as these would be minus signs). Is inconsistency here to keep the riff-raff out?

Ответить
@shannonmyers4972
@shannonmyers4972 - 29.06.2016 05:23

For the first example, would it be the same to put "title.style.position = 'relative';" ?

Ответить
@This-Is-Nick
@This-Is-Nick - 12.04.2016 11:00

Thanks for this! Quick question though - if your CSS is stored in a linked .css file, will this update it there or just enter the new styles in the HTML?

Ответить