Before asking this question, I must indicate that I tried to find EVERYTHING!
My question is how can I run javascript from an external file, and not inside my php / html. I am trying to do this.
function ClearForm() {
document.form.message.value="";
}
function comeBack(){
if (document.form.message.value == "") {
document.form.message.value="What on your mind?";
}
}
I included <script type="text/javascript" src="javascript.js"></script>in <head>, and I have a file in the root directory of javascript.js, and my php file is in the root too, so this should not be a problem! But how can I run those code snippets that you see above in the javascript.js file, and not in my php file. It works fine if I have this in a php file, but I want to split things up!
I also tried to specify the form / input id field and then use getElementById in an external JavaScript file.
But, as you can see and hear, I'm new to JavaScript, so I'm obviously doing something wrong.