// how can I write my wishes correctly?
var realContent = $('.sortable').html();
var thecode = $('#area').html();
Hey… umm what do you mean by almost solved? And I’m not sure I understand what you mean by “when the elements dragged, the generated codes mess again!”. I moved the elements around and the code seemed to be fine to me.