codeigniter - modal popup in javascript -
i have checkbox, inside modal popup div.i want check box value when checkbox checked , want place value div outside modal popup box.please me find solution. please find code below
<div class="container"> <div id="test"></div> <h2>modal popup</h2> <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#mymodal">open modal</button> <div class="modal fade" id="mymodal" role="dialog"> <div class="modal-body"> <input type="checkbox" class="ck " id="mealstotal" value="12"> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">close</button> </div> </div> </div>
please find below mentioned solution. you.
$(document).on('change','#item',function(){ if($(this).prop('checked') == true){ $('#result').html($(this).val()); }else{ $('#result').html(''); } });
div {border:1px solid red; width:100%; padding:10px;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="checkbox" name="item" id="item" value="1" /> checkbox <div id="result"></div>
let me know if not works.
Comments
Post a Comment