I wish to pass a variable to a function and have the function select elements within that variable. I\'m unfamiliar with the syntax of this case however, could any one advise?>
Use find
if you are searching the Dom.
function doSomething(container) {
var $element = $(container).find('#element');
// .. Now do something
}
Use filter
if you are wanting to search only the elements contained by container.
function doSomething(container) {
var $element = $(container).filter('#element');
// .. Now do something
}