我正在使用dojo validationTextBox并且在焦点事件上,需要消除文本框中的值。但是当用户双击文本框附近时,文本框会被选中,然后如果用户在文本框中单击,则蓝色栏会在文本框背景中显示。即使用户在文本框外单击,此蓝条也不会消失。
<!DOCTYPE html>
<html >
<head>
<link rel="stylesheet" href="https://dojotoolkit.org/reference-guide/1.10/_static/js/dijit/themes/claro/claro.css">
<script>dojoConfig = {async: true, parseOnLoad: true}</script>
<script src='https://dojotoolkit.org/reference-guide/1.10/_static/js/dojo/dojo.js'></script>
<script>
require(["dojo/parser", "dijit/form/ValidationTextBox"]);
</script>
<script type="text/javascript">
function wipeMeOut(){
dijit.byId("phone").set("value","");
}
</script>
</head>
</head>
<body class="claro">
<div>
<label for="phone">Phone number, no spaces:</label>
<input type="text" name="phone" id="phone" value="someTestString"
data-dojo-type="dijit/form/ValidationTextBox"
data-dojo-props="regExp:'[\\w]+', invalidMessage:'Invalid Non-Space Text.'" onfocus="wipeMeOut()"/>
</div>
</body>
</html>