打开表单时,光标会等待在文本框中,并显示帮助文本。因此,可能会发生一些验证错误。因此,我不希望在打开表单时自动聚焦于文本框,用户必须点击文本框并输入文本。但是,即使光标位于文本框中,这里也没有任何onfocus事件。
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();
}
请给予建议...
请点击JSFIDDLE。