javascript - remove/delete data using jquery modal form using codeigniter framework -
hi have add button add multiples data on it. im using jquery modal form add multiple data's. problem how able delete data added jquery modal form? im adding class='remove' using javascipt on it. delete data passed not totally removed. here's code below
<script type="text/javascript"> $(document).ready(function(){ // here code when delete click $('tbody').on('click', '.remove', function(e) { e.preventdefault(); $("#added-events").val( $("#added-events").val() + id.val() + '*' + event.val() + '*' + description.val() + '|'); $(this).parent().remove(); $("#date").remove(); $("#event").remove(); $("#description").remove(); $("#added-events").removedata(); }); $("#dialog-form").dialog({ autoopen: false, height: 300, width: 380, modal: true, buttons: { "add news , events": function() { $("#added-events").val( $("#added-events").val() + id.val() + '*' + event.val() + '*' + description.val() + '|'); var bvalid = true; allfields.removeclass( "ui-state-error" ); bvalid = bvalid && checklength( id, "date",6, 50); bvalid = bvalid && checklength( event, "event", 6, 50 ); //bvalid = bvalid && checklength( description, "description", 6, 50 ); if(bvalid){ $("#add tbody").append( "<tr>" + "<td id='date' name='date'>" + id.val() + "</td>" + "<td id='event' name='event'>" + event.val() + "</td>" + "<td id='description' name='description'>" + description.val() + "</td>" + "<td>" + "<a href=''>" + "edit" + "</a>" + " | " + "<a href='javascript:;' class='remove' >" + "delete" + "</a>" + "</td>" + "</tr>" ); $( ).dialog( "close" ); } }, cancel: function() { $( ).dialog( "close" ); } }, close: function() { allfields.val( "" ).removeclass( "ui-state-error" ); } }); }); </script> <div class="container" > <br /> <br /> <br /> <ul id="nav"> <li><a href="<?php echo base_url().'homepage'?>" title="home"><h4>home</h4></a></li> <li><a href="<?php echo base_url().'news-and-events'?>" title="news , events"><h4>news , events</h4></a></li> <li><a href="" title="activities"><h4>activities</h4></a></li> </ul> <div class="starter-template"> <h1 style="float:left;">add news , events</h1> <div class="clear"></div> <br /> <div id="dialog-form" title="add another"> <p class="validatetips">all form fields required.</p> <form> <table> <tr> <td><input type="text" name="date" id="datepicker" placeholder="date" class="text ui-widget-content ui-corner-all"/></td> </tr> <tr> <td> </td> </tr> <tr> <td><input type="text" name="event" id="event" placeholder="event" class="text ui-widget-content ui-corner-all"/></td> </tr> <tr> <td> </td> </tr> <tr> <td><input type="text" name="description" id="description" placeholder="description" class="text ui-widget-content ui-corner-all" /></td> </tr> </table> </form> </div> <div id="add_another" style="float:left;"> <input id="add-another" type="button" value="add another" class="btn btn-primary" /> </div> <div class="clear"></div> <br /> <form > <table id="add" width="500%" class="table-data table ui-widget ui-widget-content"> <thead> <tr class="ui-widget-header "> <td width="10%;">date</td> <td>event</td> <td>description</td> <td width="10%;">options</td> </tr> </thead> <tbody> </tbody> </table> <input type="hidden" id="added-events" name="added-events" /> <div style="float:left; margin-top:20px;"> <input type="button" id="submit" class="btn btn-success" value='add' /> </div> </form> <br /> <br /> <div class="clear"></div> <br /> <a href="javascript:;" id="back" title="back" style="float:left;">back </a> </div> </div><!-- /.container -->
i want when link delete clicked data totally removed! please me figured out. muchly appreciated. thanks
Comments
Post a Comment