O'Reilly logo

Ext JS 4 Web Application Development Cookbook by Stuart Ashworth, Andrew Duncan

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

Creating new DOM elements

After working through examples for selecting, traversing, and manipulating DOM elements, we will now move onto creating new ones and injecting them into our pages.

Initially, we will demonstrate how to create a simple list item element with some basic configuration. We will then move onto exploring how to control the position of our new element.

Getting ready

As with the previous DOM recipes, we will use the same HTML snippet defined in the first recipe of this chapter.

How to do it...

In this recipe, we are going to add a new item to the What's new in Ext JS 4? list:

  1. First, we define the configuration of our new element using a simple JavaScript object:
    var newClassSystemConfig = {
        tag: 'li',
        html: 'New Class System'
    };
  2. Next, ...

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