How do you focus a textbox in a google-chrome extension? I have tried this javascript:
<script type="text/javascript">
function setFocus()
{
document.getElementById("Target").focus();
}
</script>
</head>
<body onload="setFocus()">
<div style="float:left">
<table cellpadding="3" cellspacing="0" id="mytable" style="float:left;">
<tbody><tr><td>Target:</td> <td><input type="text" name="Target" size="25" value="" /></td></tr>
</tbody></table>
I found this code on multiple code forum websites, so I am not sure if the javascript is not working or if chrome prevents it from running.
You’re using
getElementById(), but in your exampleTargetis thenameattribute, not theID.Add
id="Target", like this: