O'Reilly logo

PhoneGap Mobile Application Development Cookbook by Matt Gifford

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

DOM manipulation

Although we may be building our applications in HTML, we still have the ability to alter and manipulate the elements within the document to create more of a dynamic application.

How to do it...

We will use the DOM manipulation methods available with the XUI library to read and write content directly within our application. The following steps will help us to do so:

  1. Create a new HTML file, including a reference to the XUI JavaScript library, the Cordova JavaScript file, and an empty script tag block before the closing head tag.
  2. Within the empty script block, define a new onLoad method.
  3. Add an on event handler, which will run the onLoad JavaScript method when the DOM has fully loaded.
  4. The body tag of the document will contain one div ...

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