jquery .hide/show form still sends data to the controller -


simple, if #parentpermission hidden, send post variable of (parentpermission) controller, there 2 variables works sending id=link controller, if 1 hidden should not send data, happens not recognize html select #link form.

code:

$(document).ready(function () {     togglefields();      $("#link").click(function () {         togglefields();     }); });  //this toggles visibility of our parent permission fields depending on current selected value of underage field  function togglefields() {     if ($("#link").val() == 'other')         $("#parentpermission").show();     else         $("#parentpermission").hide(); } 

html mvc view :

    <!-- select basic -->     <div class="form-group">       <label class="col-md-4 control-label" for="assign_article">assign article menu</label>       <div class="col-md-4">         <select id="link" name="link" class="form-control">        <?php                   foreach($get_data $showmenu) { ?>            <option value="<?php echo $showmenu['id']; ?>"><?php  echo $showmenu['title']; ?></option>           <?php } ?>           <option id="parent" value="parent">other</option>          </select>             </div>           </div>      <!-- text input-->     <div id="parentpermission" class="form-group">       <label class="col-md-4 control-label" for="menu_name">other:</label>       <div id="parentpermission" class="col-md-4">         <input id="parentpermission" name="link" type="text" placeholder="menu name" class="form-control input-md">         </div>     </div>         <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script> $(document).ready(function () {     togglefields(); //call first start out correct visibility depending on selected form values     //this call our togglefields function every time selection value of our underage field changes     $("#link").change(function () {         togglefields();     });  }); //this toggles visibility of our parent permission fields depending on current selected value of underage field function togglefields() {     if ($("#link").val() == 'parent')         $("#parentpermission").show();      else         $("#parentpermission").hide(); } </script>      <!-- select basic --> 

i resolve issue using if statement in php difficult jquery not send data using .remove function


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -