无法禁用onclick / onblur值Click to see the problem in image
name="otp" id="otp" size="50" maxlength="6" value="" onblur="encrypt_otp($(this).val());" type="password"
// HTML代码
<script>
function encrypt_otp(otp_var) {
// Stop form from submitting normally
$.ajax({
type: "POST",
url: "json/encryptData",
dataType: "json",
data: {otp :otp_var},
success: function (data) {
$('#otp').val(data['encrypted_value']);
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.status);
console.log(xhr.responseText);
console.log(thrownError);
}
})
.done(function (data) {
})
.fail(function () {
})
.always(function () {
});
}
</script>
是否可以通过preventDefault(); / return值来解决; 或者我该如何解决这个问题..