Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 单击按钮前确认已选择dropdownlist值_Jquery_Asp.net_Webforms - Fatal编程技术网

Jquery 单击按钮前确认已选择dropdownlist值

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

我需要编写jQuery代码,以便在单击按钮时确认已在dropdownlist中选择了一个值。如果未在dropdownlist中选择该值,则弹出该问题的警报

我试过一些方法,但到目前为止还没有奏效。 我编写了一个jQuery函数:

        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部件正确并且点击事件被触发。