tags:

views:

17

answers:

1

hi, I want to know how can i populate a value of input type text with ajax.

Thanks.

+1  A: 

By, AJAX I assume you mean JavaScript.

Well, you could use something like this:

<html>
<head>
<title>Form Example</title>

<script type="text/javascript">
window.onload = function()
{
    document.myform.mytext.value = "TEXTBOX";
}
</script>

</head>
<body>

<form name="myform" method="get">
<input type="text" name="mytext" />
</form>

</body>
</html>

Explanation:

Once the document has finished loading the script looks for the form named "myform". Then it looks for an element named "mytext" inside this form and you can then set/change the value property to what you desire.

thank you it works well.
kawtousse