if your javascript doesn't execute, but instead just gets displayed on the browser...

OK, I've been struggling for days trying to understand why my
javascript is just being displayed on the browser rather than
executed. I have found out the placement of the
javascript_include_tag was my problem.

I have other javascript code in my header and if I place the
javascript_include_tag before my other javascript code I only see the
javascript I'm trying to execute displayed in my browser. If I put it
after my other code, it gets executed.

I can not see what it is about my other javascript code that causes it
to matter. it only consists of function definitions and quite
honestly after wasting almost a week on this I don't want to spend
more time to figure that out. So if this happens to anyone else
hopefully the will see this and make sure your
javascript_include_tag :defaults is not being somehow ruined by having
other javascript code after it.

If anyone has some insight into this I'd love to hear it.


Have you tried pasting the html of the page into the w3c html
validator (google will find it)? Sometimes strange problems can be
seen as the browser attempts to make sense of invalid html.