I've been googling to get an answer, but i couldn't find what i want. Not sure if i typed my question wrong, but i'll try to explain.
What i'm looking to achieve is : Once the user types, i want my script to run, so my button enables when the 2 passwords are equal to eachother. As soon as the passwords are equal to eachother, the button will be enabled. If not, the button will be disabled.
function test123() {
var pw1 = $('#pw1').val();
var pw2 = $('#pw2').val();
if (pw1 == pw2) {
console.log('Valid!');
} else {
console.log('Not valid!');
}
}
<div id='register-div'>
<form method='POST' action='javascript:test123()'>
<input name='username' type='text' placeholder='username'>
<input id='pw1' name='password' type='password' placeholder='password'>
<input id='pw2' name='password2' type='password'
placeholder='password_again'>
<button type='submit'><a> REGISTER </a></button>
</form>
</div>