0

I have a drag and drop based application doing some basic workflow stuff.

I have a save button which grabs the html of a particular div and saves it into a file. This can be loaded into the app and then work can continue on it.

I'm currently doing:

$('#mydiv').html() 

to get the html of the div that I am trying to save. This works fine apart from the fact it doesn't get any of the typed entries in any input fields. I suppose this is because the values of the input aren't really in the markup.

Is there a way of me saving the input values as part of the html?

3
  • can you please put the full code? Commented Oct 3, 2016 at 9:37
  • yes according @mplungjan... use clone method. it is working as well Commented Oct 3, 2016 at 9:41
  • 1
    Apologies, I looked at the related items that were suggested before and googled the question but didn't see it. Neet to up my google game! Commented Oct 3, 2016 at 9:41

1 Answer 1

0

Use clone method---

$(document).ready(function(){
    $("button").click(function(){
        $("p").html($('#demo').clone());
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p>This is a paragraph.</p>

<div id="demo"><input type="text"></div>
<button>Copy Content</button>

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.