Moodle adds // <![CDATA[ to our inline JavaScript within our html pages which disables the Javascript statements. Is there a way to stop Moodle from making this change to the HTML?
That does no break JavaScript.
On the contrary, wrapping the JavaScript in a CDATA seciton is essential if you want the output to be valid XHTML.
If your JavaScript is not working, the problem is something else.