Step 1: Add Following javascript function in Web page.
function selectAllData(id) { var obj = document.getElementById(id); var text_val=eval(obj); text_val.focus(); text_val.select(); if (!document.all) return; // if IE return; r = text_val.createTextRange(); r.execCommand('copy'); }
Step 2: call selectAllData('id') function with passing the id of the container. See Example
Following are consolidate Code:
See demo:
Question: What is the most efficient way to deep clone an object in JavaScript?
const a = { string: 'string', number: 123, bool: false, nul: null, date: new Date(), } console.log(a); console.log(typeof a.date); // Date object const clone = JSON.parse(JSON.stringify(a)); console.log(clone);