Adding dynamic rows using jquery -


iam using jquery dynamically add multiples rows in view here code

 // start counter new row ids // setting number // of existing rows $(".datepick").datepicker(); var newrownum = 0;  // bind click event "add" link $('#addnew').click(function() {      $(".datepick").datepicker("destroy");      // increment counter     newrownum = $(producttable).children('tbody').children('tr').length + 1;      // entire "add" row --     // "this" refers clicked element     // , "parent" moves selection     // parent node in dom     var addrow = $(this).parent().parent();      // copy entire row dom     // "clone"     var newrow = addrow.clone();      // set values of inputs     // in "add" row empty strings     $('input', addrow).val('');      // insert remove link in last cell     $('td:last-child', newrow).html('<a href="" class="remove">rem<i class="icon-minus"><\/i><\/a>');       // insert new row table     // "before" add row     addrow.before(newrow);       $(".datepick").datepicker();      // add remove function new row     $('a.remove', newrow).click(function() {         $(this).closest('tr').remove();         return false;     });      $('#date', newrow).each(function(i) {         var newid = 'date_' + newrownum;         $(this).attr('id', newid);      });      // prevent default click     return false; });  // remove's default rows $('.removedefault').click(function() {     $(this).closest('tr').remove();     return false; }); 

iam using code reference http://jsfiddle.net/vdfah/200/

in jsfiddle working fine, while coming view, not working. missing script files.

i still think may missing jquery ui script files. take @ datepicker example.

http://jqueryui.com/datepicker/

http://jqueryui.com/


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -