jQuery Dynamically focus on the first INPUT or Textarea
jquery, jquery-selectors
Solution
This should do it I think
$("#formId input:text, #formId textarea").first().focus();
Problem
Here's a tricky one to start the morning. I have a series of icons. When you click an icon it loads a form. Some of the forms have input[text] others have textareas. What I'm trying to come up with is jQuery that once I load the form I can run that will... Focus in on the first input or textarea whatever it may be, dynamically so I don't need if blocks. Ideas?