this is the error i get:
Uncaught TypeError: Object #<HTMLDivElement> has no method
this is the code in the domready function:
$$('.accordion_content').slide('hide');
$$('.accordion_header').addEvent('click', function(e) {
this.getParent().getElement('.accordion_content').slide('toggle');
this.toggleClass('header_highlight');
});
// set horizontal slide for sidebar
$('priceNPay').slide('hide', 'horizontal');
$('theSidebar').style.backgroundColor = 'green';
// THIS IS WHERE IT ERRORS OUT... WHY!?
$('theSidebar').addevent('click', function(e) {
this.getElement('priceNPay').slide('toggle');
this.toggleClass('header_highlight');
});
the first chunk of code works fine. toggles like mad on all <div> elements with the relevant class. the second chunk of code hides the <div>, changes the <div>‘s colour…but errors out when trying to do the addEvent.
WHYYYY!!!????
the structure of the the only difference i can think would be relevant…if it didn’t work:
<div id='someName'>
<h1>title text</h1>
<div id='someOtherName'> (on the sidebar, this is an 'article' element)
<p>some text</p>
</div>
</div>
what i’m not following is why it’ll hide, but then won’t target for the toggle…?
thanks gang.
WR!
You are using
addeventinstead ofaddEvent.