help needed with javascript and "this" object | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 14

help needed with javascript and "this" object

The result i would like to get is explained in this code (js pannel). https://code.sololearn.com/WErAwh8fnRT8/#js An element's onclick is listenend, and i would like to catch a style property of this element and copy it to another. Can you tell me how i can do this ? Thank you : )

11th Jun 2019, 1:09 PM
Cépagrave
Cépagrave - avatar
5 Answers
+ 3
You can only read inline css by element.style. To read external css, use getComputedStyle(element). https://code.sololearn.com/WNqeyFk7F370/?ref=app
11th Jun 2019, 1:49 PM
Calviղ
Calviղ - avatar
+ 15
ᐺ ! ᖇ ᖶ ᒪ Calviղ's solution works fine, but i'm interested by your solution if it's a different one. Understanding what happens with all these ways to create functions with JS is not very intuitive when coming from python 😂 I "tried to try" 😅 what you suggest, but did not see a difference. Could you be more precise how to do it ?
13th Jun 2019, 2:18 PM
Cépagrave
Cépagrave - avatar
+ 12
Yes, perfect 😃👌 Thank you so much Calviղ ! My problem is solved.
11th Jun 2019, 1:55 PM
Cépagrave
Cépagrave - avatar
+ 12
ᐺ ! ᖇ ᖶ ᒪ😊 Got it, thanks
14th Jun 2019, 9:38 PM
Cépagrave
Cépagrave - avatar
+ 2
Haha
11th Jun 2019, 5:31 PM
Justin
Justin - avatar