I have my .js file in a seperate folder to the index.html
Here is the contents of buildit.js
//On change event for the textbox plate text
function setValue(target){
var platetext = target.value;
$('#numberplateyellow').empty();
$('#numberplatewhite').empty();
var plateregex=/^[A-Za-z]{2}[ ]{0,1}[0-9]{2}[ ]{0,1}[a-zA-Z]{3}$/
if (document.platebuilder.target.value.search(plateregex)==-1){
var answer = confirm ("Non LEGAL Plate Detected (YES WE WILL SHOW THE AGREE BOX ONCE I HAVE IT FROM TOM) \n\n Do you understand that this is now classed as a show plate ?");
if (answer) {
$('#numberplateyellow').append(platetext);
$('#numberplatewhite').append(platetext);
}
}
}
These are called on the onchange in a input box, could you explain why the alert box is not showing and also if you get a chance is it possible to .append after each letter typed ?
Kind Regards
Because you are passing an into the function you want to reference it without the “document.platebuilder”
I am not really clear on what you want to see when someone is changing the content of the input field??
If you want to run this for every key pressed then you need to set this to run on the keypressed event rather than onchange (however this would get quite annoying because of the alert…)