如何在模态淡入淡出中隐藏元素

时间:2016-10-23 03:33:32

标签: javascript jquery html bootstrap-modal

我想首先隐藏“输入密码”,然后在点击私人收音机时显示。但我的此操作代码不起作用。我在头部写javascript来隐藏文本然后显示文本。但我的代码不起作用。我该如何修复代码?非常感谢你!

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <script>
     $(document).ready(function(){
       $("#pwd").hide();
       $("#inlineRadio2").click(function(){
          $("#pwd").show(500);
       });
     });

  </script>
</head>

<body>
 <div class="container">
 <h2>Modal Example</h2>
 <!-- Trigger the modal with a button -->
 <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Open Modal</button>

 <!-- Modal -->
 <div class="modal fade" id="myModal" role="dialog">
  <div class="modal-dialog">

 <!-- Modal content-->
    <div class="modal-content">
       <div class="modal-header">
         <button type="button" class="close" data-dismiss="modal">&times;</button>
         <h4 class="modal-title">Modal Header</h4>
       </div>

       <div class="modal-body">
         <form id="form_room" method="post" action="/create-room">
            <div class="form-group">
                <label for="room_name">Name</label>
                <input type="text" id="room_name" name="room_name" placeholder="Room Name" />
            </div>
            <fieldset class="form-group">
                <label class="form-check-inline">
                  <input class="form-check-input" type="radio" name="room_type" id="inlineRadio1" value="public"> Public
                </label>

                <label class="form-check-inline">
                  <input class="form-check-input" type="radio" name="room_type" id="inlineRadio2" value="private"> Private
                </label>

                <label class="form-check-inline">
                  <p id="pwd">Enter password</p>
                  <input class="form-check-input" type="text" name="text" id="pwd" value="private">
                </label>

            </fieldset>

      </div>

       <div class="modal-footer">
         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
       </div>
    </div>

 </div>
</div>

1 个答案:

答案 0 :(得分:0)

pip install virtualenv --> installs virtualenv package
cd <proj-directory>
virtualenv venv -->creates a virtual environment by the name venv
source venv/bin/activate --> activates the virtual environment
pip install kik
deactivate --> come out of the virtual environment