Skip to content
Loading
how to save dynamically added div in another html file ?
 
 
 
 
here is my code first i add column dynamic ...then  after i drag and drop item from left sidebar in column now i want save button click to save dynamic add column and drop item in column open in new html page.
  • Bidyasagar Mishra
    Hi dip vyas, i have created complete code for you please follow the code 
    Append fields to div 
    Example: 
    1. <html>  
    2. <head>  
    3. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">script>  
    4. <script type="text/javascript">  
    5. $(document).ready(function(){  
    6. var arrayObject=[];  
    7. $("#btnAddDiv").click(function(){  
    8. var html="
      "
      ;  
    9. $("#divAppend").append(html);  
    10. arrayObject.push(html);  
    11. localStorage.setItem("array", JSON.stringify(arrayObject));  
    12.   
    13. });  
    14. });  
    15. script>  
    16. head>  
    17. <body>  
    18. <div id="divAppend">  
    19.   
    20. div>  
    21. <button id="btnAddDiv">Add Divbutton>  
    22. body>  
    23. html>  
     
    Viewpage
    Example:
    1. <html>  
    2. <head>  
    3. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">script>  
    4. <script type="text/javascript">  
    5. $(document).ready(function(){  
    6. var array = JSON.parse(localStorage.getItem("array"));  
    7. for(i=0;i<array.length;i++){  
    8. var html=array[i];  
    9. $("#divAppendBody").append(html);  
    10. }  
    11.   
    12. });  
    13. script>  
    14. head>  
    15. <body>  
    16. <div id="divAppendBody">  
    17.   
    18. div>  
    19. body>  
    20. html>  
     
  • Bidyasagar mishra plz can you give me a demo with example?
     
    Thanks for advice 
  • Sivakumar Koneti
    Hello dip vyas read once this link and follow example you can get solution
     
    https://stackoverflow.com/questions/47304883/how-to-save-dynamically-added-div-elements
  • Bidyasagar Mishra
    save your dynamic field to any webstorage (window.localStorage,window.sessionStorage) and append to your new page .
     
    Reference:
    https://www.w3schools.com/html/html5_webstorage.asp
  • Bidyasagar Mishra
    Save your dynamic field details (field type,atribute,value) to a xml file or database then append that field to you new page .