-1

For example,

<div class="level1">
</div>

I need to search for elements with class name starting with level and programatically replace them as "level2". How can this be done in extjs?

  • http://stackoverflow.com/questions/195951/change-an-elements-css-class-with-javascript – kuldarim Sep 24 '13 at 13:05
  • May I know if the answer helped you? You know, on this site you're expected to give some feedback or accept the answer that works for you. – rixo Oct 02 '13 at 08:26

1 Answers1

0

Here's how. Look at the docs for the various functions to learn how to adapt.

var targets = Ext.query('.level1');

Ext.each(targets, function(domEl) {
    Ext.fly(domEl) // get a reference to Ext.Element from the raw ROM element
       .removeCls('level1')
       .addCls('level2');
});
rixo
  • 23,815
  • 4
  • 63
  • 68