Identify .js file that changes an HTML element
Hello all.
When I am looking at a website and I see an element that is changing, eg a countdown element, how do I find out which .js file controls it? Some pages have a lot of .js files.
Thanks.
3 Replies
best way I know is to inspect the changing element and make an educated guess at what the code that's updating it will look like. Usually it'll have an ID or class nearby that you can search for in the debugger. Firefox's debugger lets you search in all files with ctrl+shift+f, don't know about chromium's
a lot of the time, websites will ship minified code though, so finding the file is of limited use most of the time
You can use the inspector and debugger to do that :
1. Open the inspector
2. Right click the element you are interested in
3. Select "break on subtree modification" if what is updated is inside the tag or "break on attribute modification" if it's an attribute
4. Trigger the element change with the inspector still open
@__zenon
(wording for the 3rd step may change from browser to browser and those elements can be under a submenu of the context menu (like "break on ..." or "breakpoints"))
Exactly what I was looking for, thanks a lot.