Jquery 单击按钮前确认已选择dropdownlist值
我需要编写jQuery代码,以便在单击按钮时确认已在dropdownlist中选择了一个值。如果未在dropdownlist中选择该值,则弹出该问题的警报 我试过一些方法,但到目前为止还没有奏效。 我编写了一个jQuery函数:Jquery 单击按钮前确认已选择dropdownlist值,jquery,asp.net,webforms,Jquery,Asp.net,Webforms,我需要编写jQuery代码,以便在单击按钮时确认已在dropdownlist中选择了一个值。如果未在dropdownlist中选择该值,则弹出该问题的警报 我试过一些方法,但到目前为止还没有奏效。 我编写了一个jQuery函数: function CheckCylinder() { if ($('#comboCylinders').value != "None") { alert('You must first select a cylin
function CheckCylinder() {
if ($('#comboCylinders').value != "None") {
alert('You must first select a cylinder.');
}
}
我在客户端单击asp按钮时调用的:
<asp:Button ID="buttonModCylinder" runat ="server" Text="Modify Cylinder"
Width= "384px" Height= "102px" CssClass="cssCommandButton "
style = "position : absolute; top:104px; Left : 189px" OnClientClick="CheckCylinder()" />
这似乎不起作用。。。
请让我知道我需要看什么。谢谢您必须与jQuery一起使用,或者使用带有值的本机元素
function CheckCylinder() {
if (document.getElementById('comboCylinders').value == "None") {
alert('You must first select a cylinder.');
}
}
假设
<select id="comboCylinders">
<option value="None">None</option>
<option value="cylinder 1">cylinder 1</option>
<option value="cylinder 2">cylinder 2</option>
</select>
没有一个
气缸1
气缸2
您必须与jQuery一起使用,或者使用带有值的本机元素
function CheckCylinder() {
if (document.getElementById('comboCylinders').value == "None") {
alert('You must first select a cylinder.');
}
}
假设
<select id="comboCylinders">
<option value="None">None</option>
<option value="cylinder 1">cylinder 1</option>
<option value="cylinder 2">cylinder 2</option>
</select>
没有一个
气缸1
气缸2
您必须与jQuery一起使用,或者使用带有值的本机元素
function CheckCylinder() {
if (document.getElementById('comboCylinders').value == "None") {
alert('You must first select a cylinder.');
}
}
假设
<select id="comboCylinders">
<option value="None">None</option>
<option value="cylinder 1">cylinder 1</option>
<option value="cylinder 2">cylinder 2</option>
</select>
没有一个
气缸1
气缸2
您必须与jQuery一起使用,或者使用带有值的本机元素
function CheckCylinder() {
if (document.getElementById('comboCylinders').value == "None") {
alert('You must first select a cylinder.');
}
}
假设
<select id="comboCylinders">
<option value="None">None</option>
<option value="cylinder 1">cylinder 1</option>
<option value="cylinder 2">cylinder 2</option>
</select>
没有一个
气缸1
气缸2
是的,下拉列表选项是这样的。@Ryan-那么答案应该有效,只要你正确地使用ASP部件并触发单击事件。是的,下拉列表选项是这样的。@Ryan-那么答案应该有效,只要你正确地使用ASP部件并触发单击事件。是的,dropdownlist选项是这样的。@Ryan-那么答案应该有效,只要你有ASP部件正确并且点击事件被触发。是的,dropdownlist选项是这样的。@Ryan-那么答案应该有效,只要你有ASP部件正确并且点击事件被触发。