var passwordText = document.getElementById("id").value;
if(passwordText == "hello300") {
return true;
}
else {
alert("Not correct")
return false
}
<script>
$(document).ready(function(){
$('#checkbox').on('change', function(){
$('#password').attr('type',$('#checkbox').prop('checked')==true?"text":"password");
});
});
</script>
<input type="password" id="password">
<input type="checkbox" id="checkbox">Show Password