Ciao ragazzi ho un form di questo tipo:
codice:
<table >
<tr>
<td>Ragione Sociale:<font style="color:red; font-size:12px;">*</font> </td><td> <input type="text" id="rag_soc" name="rag_soc" size="30"/> </td> <td><span id="error_rag_soc"></span></td>
</tr>
<tr>
<td>Indirizzo:<font style="color:red; font-size:12px;">*</font> </td><td> <input type="text" id="ind" name="ind" size="30"/> </td> <td><span id="error_ind"></span></td>
</tr>
<tr>
<td>Civico:<font style="color:red; font-size:12px;">*</font> </td><td> <input type="text" id="civico" name="civico" size="2"/> </td> <td><span id="error_civico"></span></td>
</tr>
<tr>
<td>Comune:<font style="color:red; font-size:12px;">*</font> </td><td> <input type="text" id="comune" name="comune" /> </td> <td><span id="error_comune"></span></td>
</tr>
<tr>
<td>Provincia:<font style="color:red; font-size:12px;">*</font> </td><td> <input type="text" id="prov" name="prov" /> </td> <td><span id="error_prov"></span></td>
</tr>
<tr>
<td>Cap:<font style="color:red; font-size:12px;">*</font> </td><td> <input type="text" id="cap" name="cap" size="10" /> </td> <td><span id="error_cap"></span></td>
</tr>
<tr>
<td>Codice Fiscale:<font style="color:red; font-size:12px;">*</font> </td><td> <input type="text" id="cod_fisc" name="cod_fisc" /> </td> <td><span id="error_cod_fisc"></span></td>
</tr>
<tr>
<td>Partita IVA:<font style="color:red; font-size:12px;">*</font> </td><td><input type="text" id="p_iva" name="p_iva" /> </td> <td><span id="error_p_iva"></span></td>
</tr>
<tr>
<td>Telefono:<font style="color:red; font-size:12px;">*</font> </td><td> <input type="text" id="tel" name="tel" /> </td> <td><span id="error_tel"></span></td>
</tr>
<tr>
<td>Fax: </td><td> <input type="text" id="fax" name="fax" /> </td> <td><span id="error_rag_soc"></span></td>
</tr>
<tr>
<td>E-Mail:<font style="color:red; font-size:12px;">*</font> </td><td> <input type="text" id="mail" name="mail" /> </td> <td><span id="error_mail"></span></td>
</tr>
<tr>
<td>Web Site: </td><td> <input type="text" id="site" name="site" /> </td> <td><span id="error_rag_soc"></span></td>
</tr>
<tr>
<td> <font style="color:red; font-size:12px;">* : Campi obbligatori</font> </td>
</tr>
<tr>
<td> <input type="submit" id="submit" disabled="disabled" value="Aggiungi" /><input type="reset" value="Reset" /> </td>
</tr>
</table>
Un normalissimo form, vorrei dare il focus al primo campo in questo caso #rag_soc allora faccio così
$("#rag_soc").focus();
Ma stranissimamente non va, sapete qualcosa a riguardo?