Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I see what JS is changing style to my elements in Chrome dev tools or Firefox dev tools?

My is a noob question as I am just learning JS so I am not good at it yet.

I am currently building a website ad added some JS snippets to do few actions. Now my footer has opacity: 0 and it doesn't come from CSS, therefore must come from some JS, but I cannot find it. How do I find what JS is modifying the style of a specific HTML element in the Chrome or Firefox DevTools?

Here is a screenshot to show the code: https://imgur.com/iYIeSPO

I checked all my JS files but couldn't find anything that gives my footer opacity:0.

like image 541
Andrea Avatar asked Jun 23 '19 04:06

Andrea


People also ask

How do you check every inherited style for an element in your browser's Developer Tools?

You can find it by just clicking Show Inherited check box on Chrome's computed style panel likes below.


2 Answers

The Chrome DevTools allow you to stop at a specific change in the DOM structure.

To do that right click the element and choose Break on > attribute modifications from the context menu.

Break on attribute modifications

Then, once the style attribute is added (may require a page reload), the script execution will stop at the JavaScript line where the change occurred.

like image 95
Sebastian Zartner Avatar answered Oct 20 '22 01:10

Sebastian Zartner


As far as I know you can't see which part of the code is changing the style.

Try setting breakpoints to find out where it sets it.

Maybe it isn't in your js files? It could be a script element in the document

like image 42
kess Avatar answered Oct 20 '22 00:10

kess