title: How to create CheckBox onClick Event in asp.net MVC
body: <p>I'm accessing the data for the CheckBoxes from the database, now I want to display the form for each and every checkbox if it's checked. How to achieve this?</p>
  
  <p>My form design - </p>
  
  <pre><code> &lt;div class="col-sm-12" id="roomtypes"&gt;
       @foreach(var item in ViewBag.RoomTypes)
       {
           &lt;input type="checkbox" id="chk_@item.id" name="RoomTypes" value="@item.id" /&gt; @item.type&lt;br /&gt;
  
           &lt;div class="col-sm-12" style="display:none;" id="Price_@item.id"&gt;
               &lt;input type="number" placeholder="Enter Price" id="PriceValue" /&gt;
           &lt;/div&gt;
       }
  
  &lt;/div&gt;
  </code></pre>
  
  <p>I want to display the <b>price input</b> when checkbox is checked. 
  My back-end code -</p>
  
  <pre><code> ViewBag.RoomTypes = db.RoomTypes.ToList(); 
  </code></pre>
  
  <p>My code's generating this output - 
  <a href="https://i.stack.imgur.com/APaDf.png" rel="nofollow noreferrer">My code's generating this output</a></p>