I'm having trouble understanding how to pass a jQuery object between functions. I keep getting undefined values when trying to use val after passing jQuery objects to a function.
Very simple JS Fiddle example http://jsfiddle.net/BtVqc/1/
$(document).ready(function () {
function doSomething(objectOne, objectTwo) {
$('table').append('<tr><td>' + objectOne.val() + '</td><td>' + objectTwo.val() + '</td></tr>');
}
$('button').click(function () {
var tdOne = $('td.yy');
var tdTwo = $('td.xx');
doSomething(tdOne, tdTwo);
});
});