You are executing your javascript code BEFORE the <div id="connectedUnregistered" /> was actually created.
Also note that you did not close your <div> with a corresponding </div>.
So move your javascript code to a part below your HTML. Or execute it after the page finished loading. If you are using JQuery you can do:
<script>
$(document).ready(function() {
... your code ...
});
</script>