0
votes

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?

4
$('select').focus(function(){ }) ? - im_brian_d

4 Answers

2
votes

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

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

I think that all you want to do is use the select box that was changed, in this case you can do this

$(":input, input:checkbox, .selectedMenu").change(function() {
   var $el = $(this);
   alert($el.val());
});
0
votes

you can add a focused class:

$(":input, input:checkbox, .selectedMenu").change(function() {
    $(".focused").removeClass("focused");
    this.addClass("focused");
    //Some Code here
});
0
votes

I would put this as a comment but I'm not allowed to... Maybe I misunderstood your question, but what about:

$(":input, input:checkbox, select")