jQuery: how to find first visible input/select/textarea excluding buttons?

Posted by Artem on Stack Overflow See other posts from Stack Overflow or by Artem
Published on 2010-05-12T23:22:37Z Indexed on 2010/05/13 0:14 UTC
Read the original article Hit count: 167

Filed under:
|
|

I tried

$(":input:not(input[type=button],input[type=submit],button):visible:first")

but it doesn't find anything.

What is my mistake?

UPD: I execute this on $(document).load()

<script type="text/javascript">
$(window).load(function () {
  var aspForm  = $("form#aspnetForm");
  var firstInput = $(":input:not(input[type=button],input[type=submit],button):visible:first", aspForm);
  firstInput.focus();
});
</script>

and in the debug I can see that firstInput is empty.

UPD2: I'm in ASP.NET page running under Sharepoint.

I've found so far that for some elements it does find them (for fixed ones) and for some don't. :(

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-selectors