javascript - $(selector) equivalent in Ext 3 -



javascript - $(selector) equivalent in Ext 3 -

i have menu component , trying select link selected adding class on click , removing class menu items before adding 1 time again newly clicked link.

so find parent component , query find anchors. seek chx classes of anchors , remove one/ones "selected" class.

var anchors = component.el.query("a"); ext.iterate(anchors, function(anchor, i){ anchor.removeclass('selected'); }); this.el.addclass('selected');

does not work. yet:

var anchors = component.el.query("a"); ext.iterate(anchors, function(anchor, i){ $(anchor).removeclass('selected'); }); this.el.addclass('selected');

does work. ext native equivalent create work?

with extjs 3 anchors[index] homecoming html specific node. utilize addclass or removeclass need utilize anchors.item(index);

something work:

ext.onready(function(){ var div = ext.get('test'), anchors = div.select("a"), linkchangeclass = function (anchors, anchor) { var index = anchors.indexof(anchor); anchors.removeclass('selected'); anchors.item(index).addclass('selected'); }; anchors.on('click', function() { linkchangeclass(anchors, this); }); });

fiddle: http://jsfiddle.net/98c6a57e/

javascript extjs

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -