How do I pass jQuery object to function, and work with it?

How do I pass jQuery object to function, and work with it?

I'm trying to build a function that accepts a JQuery object (a multi select drop down) and does stuff with it such as counting the non-zero options, etc, so I can limit the number of options the user can choose.

How do I refine the object's attributes, once inside the function?  The event is a select onchange and function call: "checkOptionsLength( $('#selectID'), 20)" 

function checkOptionsLength(obj,limit) {
     
      // How many non zero length selected options are there?
      // Outside of function this works >   $('#selectID option[value!=]:selected').length ?
    
      var count = $(obj) ...........;  // Inside the function how do I get at this same value as above?
}