成功提交SQL后,我的页面使用ASP(VBScript)生成带有引导类“ alert”的div。我要发生的是-用户提交表单并显示警报div之后,然后他们单击表单的第一个输入字段,我希望警报div消失。我觉得问题在于:
A.)引用由ASP在JQuery中生成的div。B.)引用具有多个引导类的div。C.)也许我打破了每个人都知道但我不知道的黄金法则。
任何帮助将非常感激。代码如下:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
$(function(){
$("qName").click(function(){
$(".alert").hide();
});
});
</script>
</head>
<body>
<!-- #include virtual="/navbar.asp" -->
<section>
<div class='container'>
<div class='row well well-lg'>
<%
If intStatus = 1 Then
Response.Write("<div class='alert alert-success'><h3 class='text-center'>Entry Successful!</h3></div>")
ElseIf intStatus = 2 Then
Response.Write("<div class='alert alert-warning'><h3 class='text-center'>This query name already exists! Would you like to update the existing entry?</h3></div>")
End If
%>
<div class='text-center'>
<h3>SQL Query Entry</h3>
<i>Add SQL statements to be used by the Query Search Web Tool.</i><br>
</div><br>
<form method="post" action="/webtools/queryadd.asp" class="form-horizontal" role="form" id="reportform">
<div class="form-group">
<label class="control-label col-sm-offset-2 col-sm-3" for="qName">Query Name: </label>
<div class="col-sm-4">
<input type="text" class="form-control" id="qName" name="qName" placeholder="Enter Query Name (60 char max)" <% If intStatus = 0 Then %>value="<%=Request.form("qName") %>"<% End If %> maxlength="60" required>
</div>
...........................................
您需要使用#
ID来引用元素
$("qName").click(function(){
应该
$("#qName").click(function(){
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句