If it shows up fine in your alert but not in your div, then the problem lies in how you put the value in the div. You are not showing us how you're doing that so we can't see why it doesn't work, but this line should do the job:
div.innerHTML = input.value.replace(/(.{10})/g, "$1<br>");