userDiv is a dynamically created button containing username and pic. Through a loop I have assigned the user's name as the div/button id. Onclick it goes to another page and assigns the name of the user to var name. However, when I get to the other page I seem to be unable to add any info. I have tried a couple of different methods (see below). I get an Object[object object] when I try to append the button itself for example and document.write just turns the screen blank altogether. If someone could explain this to me and offer a solution I would be grateful.
userDiv.id=theName;
userDiv.onclick=(function() {
window.location.href = 'Createtask.html';
alert($(this).attr("id"));
name= $(this).attr("id");
makeTask();
});
};
}
function makeTask(){
function makeTask(){
document.write(name);// blank screen
//var userBtn= document.getElementById(name);
//$("#singleUser").appendChild(userBtn);//Object [object object] error
//var singleUser = document.getElementById('singleUser');
//var greetUser = document.createElement("div");
//greetUser.innerhtml='Yippee!';// can't do innerHTML of null
//singleUser.appendChild(greetUser);//can't appendChild of null
//$("#singleUser").html("Yippee");//no error, just nothing
}
}