Search code examples
javascriptjqueryselect-menu

How do you find out if any select menu have been put into focus?


I am trying to limit query calls using a function that will place edited items into an object then pass them to a PHP script to update only the edited information. In this case I am using jQuery's change() function, however I can not find a pseudo selector for select menu's (ie. :input, input:checkbox). The only idea I have left is to add a class to all the select menu's and go from there like so:

$(":input, input:checkbox, .selectedMenu").change(function() {
    //Some Code here
});

I have checked all over and cannot find any information on this. Would this be the best way or is there an alternative?

Problem: How can you find out if any select menu has been put into focus using a pseudo selector or anything on those lines?


Solution

  • Select is its own tag. You don't need a psuedoselector:

    $("select").change(function () { ... });