Book Image

Learning Ext JS_Fourth Edition

Book Image

Learning Ext JS_Fourth Edition

Overview of this book

Table of Contents (22 chapters)
Learning Ext JS Fourth Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Working with the DOM


Ext JS provides an easy way to deal with the DOM. We can create nodes, change styles, add listeners, and create beautiful animations, among other things without worrying about the browser's implementations. Ext JS provides us with a cross-browser compatibility API that will make our lives easier.

The responsible class for dealing with the DOM nodes is the Ext.Element class. This class is a wrapper for the native nodes and provides us with many methods and utilities to manipulate the nodes.

Note

Manipulating DOM directly is considered bad practice and none of the DOM markup should be placed in the index file. This example exists only for illustrative purposes.

Getting elements

The Ext.get method let us retrieve a DOM element encapsulated in the Ext.dom.Element class, retrieving this element by its ID. This will let us modify and manipulate the DOM element. Here is a basic example:

<!doctype html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content...