Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery clone row

$( ".element1" ).clone().appendTo( ".element2" );
Comment

jquery clone table row

/*
<table>
  <tr>
    <td>one</td>
    <td><button type="button" class="js-clone-row">duplicate</button></td>
  </tr>
  <tr>
    <td>two</td>
    <td><button type="button" class="js-clone-row">duplicate</button></td>
  </tr>
</table>
*/

$(function() {
  /** Note: Assumes we are called from somewhere inside a <tr> */
  function cloneClosestTableRow(e) {
    const closestTableRow = $(e.currentTarget).closest('tr');
    const clone = closestTableRow.clone(true);
    const targetContainer = closestTableRow.parent();
    targetContainer.append(clone)
  }
  $('.js-clone-row').on('click', cloneClosestTableRow)
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: remove elemtns from an array with splice 
Javascript :: remove array value by index js 
Javascript :: replaceAll vs replace vs split join 
Javascript :: javascript function call with variable 
Javascript :: lodash group by except group null items 
Javascript :: leaflet js mobile popup not opening 
Javascript :: regular expression url 
Javascript :: Match All Letters and Numbers freecodecamp 
Javascript :: package.json merger 
Javascript :: javascript find area of triangle 
Javascript :: build json object 
Javascript :: import bootstrap 4 in react 
Javascript :: nodejs ERR_CONNECTION_REFUSED 
Javascript :: javascript copy object except one property 
Javascript :: p5.js radians 
Javascript :: core.js:5592 WARNING: sanitizing unsafe URL value 
Javascript :: check whether array ascending 
Javascript :: expressjs allow cors for all hosts and ports 
Javascript :: react hook useeffect 
Javascript :: javascript set() handler 
Javascript :: slice in javascript 
Javascript :: javascript get user from api 
Javascript :: Nuxt Use Nginx as reverse Proxy 
Javascript :: clear inteval 
Javascript :: random word react npm package 
Javascript :: json.parse 
Javascript :: empty the integer array javascript 
Javascript :: product 
Javascript :: of() angular 
Javascript :: js findindex 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =