I'm learning javascript and Im working on a text game. The do while loop isnt working. It screws that page up. I guess it loops to much and it says theres a problem with the script on this page. I need to make the page wait until it gets an answer from the form before it moves on to the next function. How do I do it? Heres the code.


<title> Legend of the Dragonstone </title>



<script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"> </script>


$(document).ready(function() {

function choosename() {
var name = "";
$("header").append("<p>Please enter your characters name.</p>");

// This is the problem loop.

do {
var name = $("#text").val();
} while (name == "");
$("header").append("Welcome " + name +".");


function tarien() {
$("header").append("<p>City of Tarien</p>");






<input type="text" id="text">
<input type="button" value="ok" id = "button">