Search Results

Search found 2 results on 1 pages for 'user605660'.

Page 1/1 | 1 

  • How to set the focus on the first <select> element of the page using JQuery?

    - by user605660
    Hi. I would like to set the focus on the first element of the page using JQuery when the page is loaded. I could successfully set the focus for first element by using $(":input:visible:first").focus(); or $(':input:enabled:visible:first').focus(); , according to jquery, set focus on the first enabled input or select or textarea on the page . I tried to use something like $('select:first').focus(); or $("select").first().focus(); or $(':visible:first').focus(); or $('enabled:visible:first').focus(); or other variations I could think of, but have not succeeded. Could anyone help me on this problem? I am a beginner for JQuery. I would like this function to work for all major browsers. Thank you very much!

    Read the article

  • Why $(":select").focus does not work while $(":input").focus works?

    - by user605660
    Hi. I have a JQuery code which does something when input or select elements get focus. Although my code for input element works, select element does not work. Here is what I do. <body> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(":input").focus(function () { //this works //do something }); $(":select").focus(function () { //this doesn't //do something }); }); </script> </body> I tried some variation on select, such as using $("select") instead of $(":select"), but did not work either. I am a beginner for JQuery. I appreciate if you could tell me how I can make it work. Thanks a lot!

    Read the article

1