20

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

Wheater yahoo

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

8
  • 1
    Let your JS debugger step through the javascript code as it gets executed. Commented Nov 11, 2012 at 19:42
  • @GaurishSharma What browser are you trying to use? Commented Nov 11, 2012 at 19:45
  • @GaurishSharma: Most browsers these days have debugging tools. Firefox has Firebug, for example. Chrome has developer tools, etc. These are what you'd use to step through JavaScript. Commented Nov 11, 2012 at 19:45
  • @CoreyOgburn Firefox/Firebug & Chrome Commented Nov 11, 2012 at 19:46
  • @David - If you can show me how its done by taking this example, It would be great Commented Nov 11, 2012 at 19:48

1 Answer 1

41

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 Element

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

Sign up to request clarification or add additional context in comments.

1 Comment

While this still doesn't answer my question but it provide a starting point which is helpful. Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.