Autofocus The HTML5 attribute does not work only in FireFox when & lt; Form & gt; & Lt; Input & gt; are loaded via Ajax. WHY?

advertisements

Below is the form which i loaded via ajax. When i run the form page directly then autofocus on c_name works in firefox but when loaded with ajax it doesn't! It works fine with opera/safari/chrome though!

<form action="client_entry_action.php" method="post" id="client_entry_form" name="client_entry_form">

<fieldset id="client_info_1">

    <label for="c_name">Name:</label>
    <input type="text" name="c_name" required placeholder="Name" autofocus="autofocus" />

    <label for="c_phone">Phone Number:</label>
    <input type="tel" name="c_phone" required placeholder="Mobile/Phone Number" />

    <label for="c_email">Email:</label>
    <input type="email" name="c_email" required placeholder="[email protected]" />

    <label for="c_address">Address:</label>
    <textarea name="c_address" ></textarea>

</fieldset>

<fieldset id="client_info_2">   

    <label for="c_info">Additional notes:</label>
    <textarea name="c_info" ></textarea>

    <input type="submit" name="add_client" value="Add Client" />

</fieldset>        

</form>


Autofocus is only done before onload has fired; it's meant to be a declarative way of specifying focus on initial page load.