There's no way to completely hide Javascript from the user, since the browser needs to download it to run it.
As John said, you can try to use a service that obfuscates code for you, like this one. Another way to accomplish what you want is to write two documents for each page of your site:
1) a document (for ex. 'file1.html') that contains your original HTML, Javascript, CSS etc.
2) another document that loads the above document via jQuery, like so:
Code:
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>$('html').load('file1.html')</script>
</head>
<body>
</body>
</html>
The first document should be the 'hidden one'. The second document won't (directly) show the Javascript of the first document.
Bookmarks