<input type="password" id="old_pass" name="old_pass" />
<input type="password" id="pass" name="pass" onblur="return;CheckReg('pass',this.value)" />
<input type="checkbox" id="show_pass" />
<script src="//code.jquery.com/jquery-latest.js"></script>
<script>
(function(){
var fields = [$('#old_pass').get(0), $('#pass').get(0)];
$('#show_pass').change(function() {
var type = this.checked ? 'text' : 'password';
try {
$(fields).prop('type', type);
} catch (e) {
// IE workaround
for (var i=0; i < fields.length; i++) {
$(fields[i]).replaceWith(function(){
return fields[i] = $('<input/>', {
id: this.id,
name: this.name,
value: this.value,
onblur: this.onblur,
type: type
}).get(0);
});
}
}
});
})();
</script>