Title: Is it possible to clone one div to another page?
Tags: javascript;jquery
Question: I have a page called riskscore.cshtml and in there i have one dynamically created div-tag with some span-tags. i want to have the same div-tag with the same span-tags in it on my next page called overview.cshtml. I am trying to use jquery like this:
function copydiv() {
$('.headdiv').clone().appendTo('.topinfo');
But this won't work. Is there another way to do it? or do i use the wrong syntax?
Comment: You could grab the class and other important info from the document element and save it in local storage and then recompile from storage on the next document... http://coding.smashingmagazine.com/2010/10/11/local-storage-and-how-to-use-it/

Comment: i submit a form on that page en redirects to another page in the same project.

Comment: yes i use mvc4. How does partialview work?

Comment: Okey thanks! but is there a good way to do this?

Comment: Are you using ASPNET MVC? You could move this html code to a partial view.

Comment: @Daniel Gustafsson - if you go to a new page(document) all javascript reloads, so you cannot accomplish this using javascript. You can clone and append elements as long as you don't reload the page.

Comment: What do you mean by _next page_? Are you trying to copy nodes from one document to another?



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 7, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2013:00:07/31/13', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<javascript><jquery>', 'Title': 'Is it possible to clone one div to another page?', 'ViewCount': 144, 'id': 17973479, 'user_AboutMe': None, 'user_AccountId': 3061789.0, 'user_DisplayName': 'Daniel Gustafsson', 'user_Reputation': 1715.0, 'user_Views': 472.0, 'user_id': 2594270.0}}