为什么隐藏的表单失去焦点时不显示?离开输入时,警报会很好地发出,但其他隐藏形式仍然不存在。
html

<body>
   <input type="text" id="myinput" value="">
   <input type="hidden" id="validation_message_email" value="enter a valid email">
</body>

javascript
window.onload = function() {
   $("#myinput").blur(myAlert);
};

function myAlert() {
   alert("This input field has lost its focus.");
   $("#validation_message_email").show();
}

最佳答案

您不能显示这样的隐藏输入。跨度更适合于此目的,

<input type="text" id="myinput" value="">
<span style="display:none"  id="validation_message_email">enter a valid email</span>

09-30 13:13
查看更多