打开表格时光标正在文本框中等待帮助文本。所以有一些验证错误发生。所以当我打开表单时,我不想重点关注,用户必须点击文本并输入文本。但是在这里没有任何聚焦事件,尽管光标在文本框中。如何从文本框中删除焦点?
if(!$.trim($("#productsTextArea1").val())){
helpTip = "help string ....";
$("#productsTextArea1").val(helpTip);
$("#productsTextArea1").css("color","#999");
$("#productsTextArea1").click(function(event){
if($("#productsTextArea1").val().indexOf("Enter a return")>-1){
$("#productsTextArea1").css("color","black").val("");
}
});
} else {
$("#productsTextArea1").blur();
}
请指教...
你为什么要运行在页面加载这个功能呢?为什么不推迟,直到用户实际点击textarea? –