Set autofocus in the Laravel input field using the form :: text

How to set autofocus to a specific field using a form?

I managed to set the focus by registering the macro, but is it possible to set it in Form::text ?

+7
html5 laravel
source share
3 answers

Simply pass the third parameter in the form :: text as an array with "autofocus" => "autofocus".

Sorry to bother you guys, maybe someone will find this useful.

+12
source share

You cannot get around this simply by the fact that you have to set the second parameter, which is the "value" of the input, to something, if you do not want you to skip null there, and it will look like this:

 {{Form::text('username', null, array('autofocus'=>'autofocus'))}} 
+1
source share

As JoshP pointed out, you can simply use β€œautofocus” as the third parameter:

 Form::text('email', ' user@gmail.com ', array('autofocus')) 
0
source share

All Articles