Lincolnmyth
Lincolnmyth

Reputation: 63

How to autoFocus aui:input tag

I have been working on a view.jsp file with aui tags but i stumbled on a small problem. I wish to auto focus on the first input of a form when the page loads but i haven't been able to achieve that.

I am working with liferay 7.3.5

This is my code so far:

<%@ include file="/init.jsp" %>
<portlet:actionURL name="searchEmail" var="searchEmailUrl" />
<div class="Custom_login_wrapper" >
    <div class="Custom_login_container">
        <aui:form action="<%= searchEmailUrl %>" name="<portlet:namespace />fm">
            <div class="svg_container" >
                <div class="intranetsvg_container" >
                    <h1 style="text-transform: uppercase;margin: 0;">Aanmelden</h1>
                </div>
            </div>
            <aui:row>
                <aui:col width="100">
                    <aui:input cssClass="email input" autoFocus="true" type="email" required="true" placeholder="Emailadres:" label="email-adres" name="email" id="email" />
                </aui:col>
                <aui:button-row>
                    <aui:button id="searchBtn" cssClass="searchBtn" value="Volgende" name="button2" type="submit"></aui:button>
                </aui:button-row>
            </aui:row>
        </aui:form>
    </div>
</div>

as per the aui documentation i added the autoFocus attribute to the input but this doesn't seem to have an effect. I also tried with javascript and jquery but perhaps aui:input isn't responsive to javascript? I'm hoping that someone can tell me how to focus on this input tag on page load, any help would be appreciated.

Upvotes: 0

Views: 24

Answers (0)

Related Questions