I have writen an ajax page that will change a particular div content. In that the ajax code will create a textbox.
Now I would like to focus on that textbox after calling that function. on clicking a button the function will get called as
function addnewitem5()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("aa433").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","ajax-production.php?type=sales",true);
xmlhttp.send();
}
on the ajax-production.php
the code is just
<?php echo '<input type="text" name="barcode" id="barcode"/>';?>
How can I focus on that textbox?
by this you can set focus on text box..