This is why things don't work with your example:
load() is an async call, so you need to continue your treatment only when the call ended
$hold.find('#removediv').remove() will only select the div, not actually remove it
For your code o work you need, to make use of the callback and the end, like this:
<script>
$(function() {
$("#l").click(function() {
var url = 'b.htm';
$("#content").load(url + " #somediv", function(data) {
var allHtml = $(data),
newHtml = allHtml.find("#removediv").remove().end();
console.log(newHtml.html());
});
});
});
</script>
assuming that you have a file with this html:
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<title>Stackoverflow example</title>
</head>
<body>
<h1>Hello</h1>
<a href="#" id="l">load content</a>
<div id="content">Empty</div>
</body>
</html>
and b.htm has
<div>
<div id="somediv">
<div id="removediv" class="stuff">A</div>
<div id="okdiv" class="stuff">B</div>
<div id="okdiv" class="stuff">C</div>
<div id="okdiv" class="stuff">D</div>
</div>
</div>
the output would be (In Firefox as Chrome blocks the call for b.htm as a cross domain call as it's a local file)

output show:
console.log('data');
console.log(data);
console.log('newHtml');
console.log(newHtml.html());
Example is on my Dropbox if you need to see both files.
using your own code:
$(function() {
$('<div/>').load('page.php #somediv', function(data) {
// 'data' has the page.php #somediv part
var allHtml = $(data);
if ($.cookie('mycookie') !== null)
allHtml = allHtml.find("#removediv").remove().end();
else
document.cookie = "mycookie=1;expires=Thu, 31 Dec 2020 23:59:59 UTC; path=/"
$('#divtwo').html(allHtml);
});
});
$hold=$hold.not('#removediv');won't affect the DOM. It simply creates a new jQuery result set and stores it in the variable called $hold.$holdto populate thedivtwohtml.$hold.find('#removediv').remove()should do the right thing. However, the.loadmethod initiates an asynchronous ajax request - is your code being executed after the response is received (i.e. in the "complete" callback) or is it possible this code is being called too early?