javascript - Two Modals checkbox stay the same -


hi there having problem modals have 2 modals, , when select checkboxes of second modal , go first modal change , take same checks second. want not change checks.

<button type="button" class="btn  btn-block btn-primary btn-md" data-toggle="modal" data-target="#mymodal" data-whatever="0">                 <i class="fa fa-plus-square" aria-hidden="true"></i>                 &nbsp&nbsp drop down <span class="caret"></span>             </button>              <!-- modal -->             <div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel">                 <div class="modal-dialog" role="document">                     <div class="modal-content">                         <div class="modal-header">                             <button type="button" class="close" data-dismiss="modal" aria-label="close">                                 <span aria-hidden="true">&times;</span>                             </button>                             <h4 class="modal-title" id="mymodallabel">@lang('general.select_question_type')</h4>                         </div>            <div class="modal-body">               <div class="optionsformm ">         @for($i = 0; $i <=3; $i++)             <div class="form-group {{ $errors->has('options.'.$i) ? ' has-error': '' }}"         id="option{{ $i }}">         <div class="checkbox col-md-1 control-label" style="padding-left: 0px;margin-top: -2px;">           <label>             <input type="checkbox" class="checkbox" name="dropdown_position" value="0"  id="recipient-name" >           </label>         </div>               <div class="col-md-8">           <input type="text" name="options[{{ $i }}]" value="{{ old('options.'.$i) }}"                   class="form-control" placeholder="@lang('general.option') {{ $i }}"  id="message-text">           @if($errors->has('options.'.$i))           <div class="col-md-12">           </div>           <span class="help-block">             <strong>{{ $errors->first('options.'.$i) }}             </strong>           </span>           @endif         </div>          <div class="col-md-1">         <input type="radio" name="correct" value="{{$i}}" {{ $i==1 ? 'checked' :'' }}>         </div>         <div class="col-md-1">            <button type="button" value="{{ $i }}" class="btn btn-flat btn-default btn-sm"                   id="delete_option" title="@lang('general.remove_option')">             <i class="fa fa-trash-o" aria-hidden="true">             </i>           </button>         </div>       </div>          @endfor        @if($errors->has('options.1'))        <span class="help-block">         <strong>{{ $errors->first('options.1') }}         </strong>       </span>       @endif     </div> 

and here javascript code first 1 values , second add more buttons modals

 <script type="text/javascript">   $('#mymodal').on('show.bs.modal', function (event) {   var button = $(event.relatedtarget)    var recipient = button.data('whatever')    var modal = $(this)   modal.find('.checkbox').val(recipient)    });     </script>   <script>      var u = 0;     $('#add_dropdown').click(function () {       u++;       $('.optionsform ').append('<div class="col-md-4" style="min-height: 60px;"><button type="button" class="btn  btn-block btn-primary btn-md" data-toggle="modal" data-target="#mymodal" data-whatever="' + u + '"><i class="fa fa-plus-square" aria-hidden="true"></i>&nbsp&nbsp drop down <span class="caret"></span></button></div>');       $('input').icheck({         radioclass: 'iradio_square-blue',           checkboxclass: 'icheckbox_square-blue',         increasearea: '20%'         });     });   </script> 

so need value of text not change on modals, checkboxes , radio. thank you.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -