Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
124
rated 0 times [  131] [ 7]  / answers: 1 / hits: 28870  / 12 Years ago, sun, november 11, 2012, 12:00:00

On yahoo weather page, there is link labelled as C that changes temperature unit from Fahrenheit to Celsius.


Wheater


I am looking debug this action and understand what JavaScript gets executed behind the scenes which convert F into C. What is the way of debug such things?


Link: http://weather.yahoo.com/?w=2295401


More From » dom-events

 Answers
28

Using Google Chrome,




  1. Right Click on an item which is changing 'visually' when the action you want to debug takes place, and click 'Inspect Element'. In this case we can inspect the temperature value


  2. Right Click again on the element from the DOM view and select Break on -> Attributes modifications


  3. Now perform the action you want to debug (in this case click the °C item)




Inspect



You will notice that the code will 'Pause' and you can debug code in the debugger



Debugger



In this case however, the code is compressed/minified so it will be very tough to understand what is actually going on, but the same approach could be used for other similar situations



Update:



Watch this Chrome Dev Tools video for lots of useful debugging tips:
http://www.youtube.com/watch?v=BaneWEqNcpE


[#82050] Friday, November 9, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
marinal

Total Points: 655
Total Questions: 99
Total Answers: 99

Location: Svalbard and Jan Mayen
Member since Sun, Sep 25, 2022
2 Years ago
;