O'Reilly logo

PHP Ajax Cookbook by R. Rajesh Jeba Anbiah, Roshan Bhattarai, Milan Sedliak

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Triggering JavaScript early/on DOM load

In Web 2.0 websites that have containers and animations, we'd want the JavaScript code to get executed as quickly as possible, so that the users won't see a flickering effect when we apply hide, show, or animation effects. Also, when we handle any events through JavaScript or JavaScript frameworks, we'd want the events such as click, change, and so on get applied to the DOM as quickly as possible.

Getting ready

Earlier, JavaScript developers mixed JavaScript and HTML together. This practice is called inline scripting. As the Web was evolving, more standards and practices came up. Unobtrusive JavaScript practice generally means that JavaScript code is separated from markup code and JavaScript is handled in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required