autofocus for textfield.

while onloading of the page the input field has to get autofocused as in the scenario of the default mendix popup page.I achived it but the autofocus is shifitng to last feild.Provide any relevent Idea or answer if u have worked on it before. $(document).ready(function(){ $(".text3").ready(function(){ .$("input").trigger("focus");  }); }); the above pasted code is I am using in that text3 is the class name of my input field but it is not giving importance to class in this.
1 answers

You are almost there. Trick is that you need to set the focus on the first child of your input element. Here is my working code, where ‘focusonme’ is the class to add to your input-element in StudioPro and you already found the location to put the code:

$(document).ready(function() {              //Wait for all dom-elements to be rendered
  let inputstextbox=$('.focusonme')[0].firstChild;  // find input-element of focusonme
  if (typeof inputstextbox !='undefined'){          // check if you have found one
} catch (error) {}

Included error-handling to render unexpected results harmless.