First, in jsFiddle, you need to set the location of your code either at heador at the end body.
Secondly, you have invalid string matches. Try the following:
function passcheck() {
var pass = document.getElementById("pass").value;
var passverify = document.getElementById("passverify").value;
if (pass == passverify) {
document.getElementById("pver").innerHTML = '<font color="green">แแแ แแแแแ แแแแฎแแแแ!</font>';
} else {
document.getElementById("pver").innerHTML = '<font color="red">แแแ แแแแแ แแ แแแแฎแแแแ!</font>';
}
}
Updated script
Here is the equivalent in jQuery:
$('#passverify').change(function() {
if ($('#pass').val() == $('#passverify').val()) {
$("#pver").html('<font color="green">แแแ แแแแแ แแแแฎแแแแ!</font>');
} else {
$("#pver").html('<font color="red">แแแ แแแแแ แแ แแแแฎแแแแ!</font>');
}
});
Script example
source
share