我正在验证表单中的控件...如果控件为空我想显示带有错误消息的jquery工具提示..这就是我正在做的...
if (document.getElementById("ctl00_ContentPlaceHolder1_ListDiscipline")
.selectedIndex == -1)
{
document.getElementById("ctl00_ContentPlaceHolder1_ErrorMsg").innerHTML =
"please select your Discipline";
document.getElementById("ctl00_ContentPlaceHolder1_ListDiscipline").focus();
return false;
}
我想这样做,
if (document.getElementById("ctl00_ContentPlaceHolder1_ListDiscipline")
.selectedIndex == -1)
{
// show tooltip besides the control with the error message...
document.getElementById("ctl00_ContentPlaceHolder1_ListDiscipline").focus();
return false;
}
任何建议......
答案 0 :(得分:4)
Here你会发现一些有用的插件来制作带有jQuery的工具提示
例如,如果安装了qTip,您可以执行以下操作:
if (document.getElementById("ctl00_ContentPlaceHolder1_ListDiscipline")
.selectedIndex == -1)
{
$('#ctl00_ContentPlaceHolder1_ListDiscipline').qtip(
{
content: "please select your Discipline"
});
document.getElementById("ctl00_ContentPlaceHolder1_ListDiscipline").focus();
return false;
}