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

Manipulating DOM elements

So far we have discussed selecting elements and traversing through them. We will now explore how to manipulate those elements once we have got our hands on them.

We will start by changing the style of an element by updating its inline styles and then by adding CSS classes. Following this we will explore how to show and hide elements.

Getting ready

Once again we will use the HTML snippet defined in the Selecting DOM elements recipe.

How to do it...

  1. Firstly, we will make the book's title bigger, color it red, and give it a bottom border by updating those specific styles using the setStyle method.
  2. Retrieve a reference to the element, in this case the book's title heading:
    var bookTitleEl = Ext.get('book-title');
  3. Update the element's ...

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