joris

Code

Apr 26th, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function() {
  2.             var count = 0;
  3.  
  4.  
  5.             $("#add_btn").click(function(){
  6.                     count += 1;
  7.                     $().attr('class','inputtext');
  8.                 $('#container').append(
  9.                          '<tr class="records">'
  10.                          + '<td ><div class="uiBoxLightblue" id="'+count+'">' + count + '</div></td>'
  11.                          + '<td><input class="inputtext" id="nim_' + count + '" name="nim_' + count + '" type="text"><br/></td>'
  12.                          + '<td><input class="inputtext id="nama_depan_' + count + '" name="nama_depan_' + count + '" type="text"></td>'
  13.                          + '<td><input class="inputtext id="nama_belakang_' + count + '" name="nama_belakang_' + count + '" type="text"></td>'
  14.                          + '<td><a class="remove_item" href="#" >Delete</a>'
  15.                          + '<input id="rows_' + count + '" name="rows[]" value="'+ count +'" type="hidden"></td></tr>'
  16.                     );
  17.                 });
  18.                 $(".remove_item").live('click', function (ev) {
  19.                 if (ev.type == 'click') {
  20.                 $(this).parents(".records").fadeOut();
  21.                         $(this).parents(".records").remove();
  22.             }
  23.             });
  24.         });
Advertisement
Add Comment
Please, Sign In to add comment