无法在模态对话框中检查(选择)单选按钮

时间:2017-12-05 06:26:39

标签: javascript jquery html modal-dialog

在我的页面中,我使用的是自定义模式对话框,在我使用表单的模态中。我在该表格中放了两个单选按钮,但我无法检查其中任何一个。

<div id="user_modal" class="modal modal__bg" role="dialog" aria-hidden="true">
    <div class="modal__dialog">
        <div class="modal__content">
            <h1>User registration</h1>

            <form action="" id="u_register_form">

                <div class="form-group">
                  <input type="text" class="form-control" id="fullname" placeholder="Full name" required/>
                </div>

                <div class="form-group">
                    <label class="radio-inline"><input type="radio" value="w" name="optradio"/>Worker</label>
                    <label class="radio-inline"><input type="radio" value="e" name="optradio"/>Engineer</label>
                </div> 

                <div class="form-group">
                  <input type="text" class="form-control" id="username" required placeholder="Username">
                </div>

                <div class="form-group">
                  <input type="password" class="form-control" id="u_pwd1" pattern=".{8,}" required placeholder="Password"/>
                </div>

                <div class="form-group submit_btn">
                    <input class="btn btn-success" id="u_register_btn" type="submit" value="SAVE">
                </div>

            </form>

            <!-- modal close button -->
            <a href="" class="modal__close demo-close">
                <svg class="" viewBox="0 0 24 24"><path d="M19 6.41l-1.41-1.41-5.59 5.59-5.59-5.59-1.41 1.41 5.59 5.59-5.59 5.59 1.41 1.41 5.59-5.59 5.59 5.59 1.41-1.41-5.59-5.59z"/><path d="M0 0h24v24h-24z" fill="none"/></svg>
            </a>

        </div>
    </div>
</div>

2 个答案:

答案 0 :(得分:0)

绝对检查您的控制台是否有错误。代码在一个简单的记事本.html文件中自行加载。错误可能是在此之前或者使用&#34;无线电内联&#34;类。

答案 1 :(得分:0)

它的工作正常我做了什么改变......

&#13;
&#13;
<div id="user_modal" class="modal modal__bg" role="dialog" aria-hidden="true">
    <div class="modal__dialog">
        <div class="modal__content">
            <h1>User registration</h1>

            <form action="" id="u_register_form">

                <div class="form-group">
                  <input type="text" class="form-control" id="fullname" placeholder="Full name" required/>
                </div>

                <div class="form-group">
                    <label class="radio-inline"><input type="radio" value="w" name="optradio"/>Worker</label>
                    <label class="radio-inline"><input type="radio" value="e" name="optradio"/>Engineer</label>
                </div> 

                <div class="form-group">
                  <input type="text" class="form-control" id="username" required placeholder="Username">
                </div>

                <div class="form-group">
                  <input type="password" class="form-control" id="u_pwd1" pattern=".{8,}" required placeholder="Password"/>
                </div>

                <div class="form-group submit_btn">
                    <input class="btn btn-success" id="u_register_btn" type="submit" value="SAVE">
                </div>

            </form>

            <!-- modal close button -->
            <a href="" class="modal__close demo-close">
                <svg class="" viewBox="0 0 24 24"><path d="M19 6.41l-1.41-1.41-5.59 5.59-5.59-5.59-1.41 1.41 5.59 5.59-5.59 5.59 1.41 1.41 5.59-5.59 5.59 5.59 1.41-1.41-5.59-5.59z"/><path d="M0 0h24v24h-24z" fill="none"/></svg>
            </a>

        </div>
    </div>
</div>
&#13;
&#13;
&#13;