0

I have a html page with jquery enabled.

Once the user modifies the page with jquery interactions, I need to save the resulting DOM.

As per [Get Jquery DOM][1], $(document).html(); should give me the html so I am trying to alert the

$(document).html();

However I get the alert undefined element

http://jsfiddle.net/ujYzM/3/

Please can somebody help

Thanks in advance.

rahularyansharma
  • 11,156
  • 18
  • 79
  • 135
user646108
  • 23
  • 7

2 Answers2

1

You probably want to get the DOM using $('html') or $('body')

jsFiddle

alert($('html').html());
alert($('body').html());
Daniel Imms
  • 47,944
  • 19
  • 150
  • 166
0

This should work

$(document).ready(function () {
     $("#sketch_board").droppable({
        hoverClass: 'smbrd',
        tollerance: "touch",
        drop: function (event, ui) {
            $("#sketch_board").append($('#div_drag').html());
            var x = $('#sketch_board').text();
            alert(x);
        }
    });

    $('#div_drag').draggable({
        containment: "window",
        revert: true
    });
});
NewUser
  • 3,729
  • 10
  • 57
  • 79