如果我们有这个代码
<form>
<input required oninvalid="this.setCustomValidity('error messege')" />
<input type="submit">
</form>
当我们单击提交按钮时,会显示包含错误消息文本的气球...
现在如果我们想触发这个气球来显示我们能做什么?例如我们有这个 HTML 代码:
<input id="myTextBox" >
<input type="button" onclick="showBalloon()" >
<script>
function showBalloon(){
var elem = document.getElementById('myTextBox');
elem.setCustomValidity('error messege');
// my problem is HERE !!!
elem.whichFunctionShouldICallOrWhatToDo(); // this shows balloon of myTextBox
}
</script>