As you've found out, you cannot observe for an element until it is a part of the document.
This:
Code:
Event.observe('menuTrainingProvided','click', addTrainingProvided, false);
Basically means that this:
Code:
<div id="menuTrainingProvidedDIV">
<a href="#" id="menuProfessionalOutreach">
<img src="" title="Training Provided Image">
Training Provided
</a>
</div>
shall behave like so:
Code:
<div id="menuTrainingProvidedDIV"
onclick="addTrainingProvided();">
<a href="#" id="menuProfessionalOutreach">
<img src="" title="Training Provided Image">
Training Provided
</a>
</div>
If you write it like that, you won't even need to 'observe' it. Further, it would probably be better like so:
Code:
<div id="menuTrainingProvidedDIV">
<a href="#" id="menuProfessionalOutreach"
onclick="addTrainingProvided();return false;">
<img src="" title="Training Provided Image">
Training Provided
</a>
</div>
or like:
Code:
<div id="menuTrainingProvidedDIV"
onclick="addTrainingProvided();">
<a href="#" id="menuProfessionalOutreach"
onclick="return false;">
<img src="" title="Training Provided Image">
Training Provided
</a>
</div>
Bookmarks