HOW TO: Set Focus for Field in Custom JS

I am not a JS programmer by default and I could not find a thread on how to set the focus for a particular field. I help this code snippet helps someone.

Uses Jquery to find the data field name attribute.
Set focus will set the browser cursor to a particular field.

$(“[data-fieldname=‘your_field_name’]”).focus()

Example:
$(“[data-fieldname=‘sn’]”).focus()

1 Like

try this one
$(“[data-fieldname=address]”).focus()

1 Like