On my current workspace site, ( run from cloud 9 IDE
)I have two very simple blocks of code:
HTML
<span class="subject"> Github </span>
<div class="content">
<hr>
<span class="lSubj" style="color: navy;"> <a href="link"> Link </a> </span>
<pre><div class="gitContent">Filler Text</div></pre>
</div>
Javascript:
function gitFire(){
var gits = document.getElementsByClassName("gitContent");
for( var i = 0; i < gits.length; i ++ )
{
var element = gits[i];
alert( element.innerHTML );
}
}
document.onload += gitFire();
CLOUD 9 space Link: https://c9.io/lemony_andrew/leandrew/workspace/test.html
Js Fiddle Link: http://jsfiddle.net/T3jkp/1/
- No errors in debug console.
- Cloud 9 isn't finding classes, but jsfiddle does.
- Cloud 9 Is executing the code. I believe the problem is with: getElementsByClassName
- Changing
document.onload += gitFire;
todocument.onload = gitFire;
does not effect the outcome.
I think it may be cloud 9's fault, but I have never had any problems like this before. Why else could it possibly work on jsfiddle and not my workspace?