askohen
15 Nov 2007, 9:30 AM
Hi. I am not sure if this is even the best approach I am taking, but here is what I am trying to do:
I am playing around with the toggle function and have it toggling the display of 'slave' elements when I click a 'master' element (the master toggles visibility of its slave). I got it working well with one master and one slave but I now want to get all master elements in the document, find each one's next sibling and toggle visibility of each one's next sibling.
function toggleExample(){
var masters = Ext.select('.master');
masters.each(function(){
var slave = this.getNextSibling();
//code to do the toggling to slave
});
The problem is that getNextSibling returns an HTMLElement, not an EXTElement. I tried this:
var slave = new Element(this.getNextSibling());
but got an error saying I can't create an object in this context. Is there anyway I can apply Element methods to the next siblings?
I am playing around with the toggle function and have it toggling the display of 'slave' elements when I click a 'master' element (the master toggles visibility of its slave). I got it working well with one master and one slave but I now want to get all master elements in the document, find each one's next sibling and toggle visibility of each one's next sibling.
function toggleExample(){
var masters = Ext.select('.master');
masters.each(function(){
var slave = this.getNextSibling();
//code to do the toggling to slave
});
The problem is that getNextSibling returns an HTMLElement, not an EXTElement. I tried this:
var slave = new Element(this.getNextSibling());
but got an error saying I can't create an object in this context. Is there anyway I can apply Element methods to the next siblings?