As the name suggests, that is an HTML validator and would only look for the HTML syntax errors and bad practices. Whereas, what you are looking for is JavaScript validator, try
JSLint[
^]. I entered your JavaScript code there,
function substitute() {
var myValue = document.getElementById('myTextBox').value;
if(myValue.length == 0) {
alert('Please enter a real value in the text box!');
return;
}
var myTitle = document.getElementById('title');
myTitle.innerHTML = myValue;
Have a look at the errors, there are 6 of them already in the bottom of the page and also, it also tells that JavaScript engine was
expecting a } but found end.