Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/473.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
Javascript 使用引导Radio n按钮设置隐藏字段值_Javascript_Twitter Bootstrap - Fatal编程技术网

Javascript 使用引导Radio n按钮设置隐藏字段值

Javascript 使用引导Radio n按钮设置隐藏字段值,javascript,twitter-bootstrap,Javascript,Twitter Bootstrap,我有一些麻烦设置值的hiddenfield与boostrap单选按钮。这是带有单选按钮和隐藏字段的按钮组 <div class="myRow"> <div class="smallCol"> <div class="btn-group hiddenRFIDValue" data-toggle="buttons"> <label clas

我有一些麻烦设置值的hiddenfield与boostrap单选按钮。这是带有单选按钮和隐藏字段的按钮组

<div class="myRow">
                <div class="smallCol">
                    <div class="btn-group hiddenRFIDValue" data-toggle="buttons">
                        <label class="btn btn-default">
                            <input type="radio" class="btn" name="options" id="alwaysRFID" autocomplete="off">
                            Always
                        </label>
                        <label class="btn btn-default">
                            <input type="radio" class="btn" name="options" id="neverRFID" autocomplete="off">
                            Never
                        </label>
                        <label class="btn btn-default">
                            <input type="radio" class="btn" name="options" id="sometimesRFID" autocomplete="off">
                            Sometimes
                        </label>
                    </div>
                </div>
            </div>
        </div>
        <asp:HiddenField ID="hiddenRFIDValue" runat="server" />
下面是我试图设置值的脚本

<script>
    $(".hiddenRFIDValue .btn").click(function () {
        // whenever a button is clicked, set the hidden helper
        $("#hiddenRFIDValue").val($(this).text());
    });
</script>

希望你们中有人能帮忙。谢谢

我修好了!生成html时,它更改了隐藏字段的id,因此scipt需要如下所示

<script>
    $(".hiddenRFIDValue .btn").click(function () {
        $("#MainContent_hiddenRFIDValue").val($(this).text());
    });
</script>

$hiddenRFIDValue.val$this.parent.text@Tushar当我将父对象放在try$hiddenRFIDValue.val$this.closest'label.btn.text上时,由于某种原因,该值仍然为null@Tushar仍然无效。最近的标签是做什么的?