Jump to content

Problems with focusing on a form element...


almightyegg

Recommended Posts

I've used this exact code before yet it refuses to work.

 

Here's my javascript:

<body onLoad="document.form1.contact.focus()">

 

here's the form:

<form action="send.php" method="POST" name="form1">
<table border="0">
<tr><td width="100"><b>To</b></td><td><input type="text" id="tokenize" name="contact" /></td></tr> <!--this is the form element I'm trying to focus on... but ti doesn't work. Perhaps it's because it has other javascript working on it too? though I didn't think that'd effect it-->
<tr><td> </td><td></td></tr>
<tr><td><b>Subject</b></td><td><input type="text" name="subject"></td></tr>
<tr><td> </td><td></td></tr>
<tr><td><b>Message</b></td><td></td></tr></table>
<center>
<input type=button value='Bold' onclick="aaatml(1);"><input type=button value='Italics' onclick="aaatml(2);"><input type=button value='Underline' onclick="aaatml(3);"><input type=button value='Strikethrough' onclick="aaatml(6);"><input type=button value='Link' onclick="aaatml(4);"><input type=button value='Image' onclick="aaatml(5);">
<br>
<textarea id="colorBox" name="desc" style="width: 450px; height: 190px;"></textarea><br>
</center>
<input type="submit" value="Send">
</form>

Link to comment
Share on other sites

You are using a jQuery plugin to modify the input and turn it into a fancy type-ahead dropdown. You need to look at the documentation for whatever plugin you are using, they should have some focus() method you can use with that.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.