Let's make it work with spaces :)
Create your divs like this:
<div title="Location 3" id="Location3" class="nav">
Remove the spaces in your id's then add title
attribute which can have spaces.
Then have your script like this:
$("#content div.nav").each(function() {
$(".navi ul").append('<li><a href="#'+ $(this).attr("id") + '">' + $(this).attr("title") + '</a></li>');
});
Notice that I replaced the second id
with title
Check the demo Here
Hope it helps