Knowledge7

The Linux and Mobile Solution Provider

  • About
  • Training
  • Services
  • Clients
  • In the news
  • Blog
  • Contact Us
You are here: Home / Topic / DOM manipulation with Javascript

DOM manipulation with Javascript

This topic is part of our Mobile Application Development with HTML5 training

Javascript is a powerful and expressive programming language. Learning how to write Javascript properly by focusing on its good parts (and ignoring its bad parts) is a necessity if one wants to create maintainable code.

The work to do is:

  • Show a simple alert while the webpage (created previously) is loading
  • Use window.onload to execute code only when the whole content has been loaded
  • Display the number of songs in an alert
  • Show additional statistics like number of distinct countries and their names
  • Hide all country names using Javascript and some CSS
  • Use a timeout and callbacks to show/hide countries every second

The next step is to enhance the application to use jQuery (ready function, selectors, etc), one of the most formidable Javascript libraries ever.

jQuery can be used to easily:

  • Display the table of songs with stripes (with the help of some CSS)
  • Toggle the striped rows in the songs table when the mouse is over the table
  • etc.

Finally, it is also important to know how to use a library like Underscore.js which provides a collection of useful functions (such as map, filter, uniq, etc.) to increase programmer productivity. Underscore.js simplifies existing (non-functional) Javascript code and, hence, make it more maintainable.

This topic is part of our Mobile Application Development with HTML5 training

Our forthcoming training courses

  • No training courses are scheduled.

Leave a Reply

Your email address will not be published. Required fields are marked *

Looking for something?

Want to know more?

Get our newsletter

Discover the latest news, tips and tricks on Linux, the Web and Mobile technologies every week for FREE

This work is licensed by Knowledge7 under an Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license.