Is there a way to make $.fn.find() return the elements in the order they
appear in the dom instead of grouped by selector?
For example, let's say I have a form and I want to get the first form
control, whether it's an input, select, or textarea. Here's some basic HTML:

<form id="#myform">
    <select>// ... //</select>
    <input type="text" />
</form>

I thought I could do this, but it's returning the wrong element:

var form_controls = $('form#myform').find('input, select, textarea');
console.log('first: ' + form_controls[0].tagName); // <-- first: INPUT,
should be SELECT

Is there a way to get the desired effect with jQuery? Thanks!

-Hector

Reply via email to