I was going to write about how to debug an HTML iPhone web application, but Apple has this covered very well in their Safari debugging tip, so I'll generally just refer you to that tip.
For developers that like their information fast, here's the abridged version of that iPhone Safari debugging tip:
- On your iPhone, tap Settings, then Safari, scroll down and tap Developer.
- On the next screen, turn on the Developer Console.
After you've changed this setting, a banner will appear above your web pages in the iPhone Safari browser when messages are in the console. Just click the Message banner to see the message content.
iPhone Safari console debugging messages
<script> console.log("My log message goes here."); console.warn("My warning message goes here."); console.error("My error message goes here."); console.info("My information message goes here."); </script>
Again, for detailed information and screenshots, please see that Apple documentation page.