if you going to use jquery you can use it all the way so instead of doing
var pageEl = document.getElementById("ElementId");
var contentToProcess = pageEl.innerHTML;
you can do
var contentToProcess = $('#ElementId').html();
example how you can do what you want if ii understand you correctly
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
var content = $('<div><p>one</p><p>two</p></div>');
// do some operations
content.find('p:first-child').remove();
// create a container to append your conmtent
var container = $('<div/>');
//append the content to the container
container.append(content);
// if you dont append the content to a container you do not get the parent tag (<div></div>)
alert(container.html());
});
</script>
<title>Test</title>
</head>
<body>
<p>Test</p>
</body>
</html>
Bookmarks