> So in my refactoring, I have been doing this: > > function test(arg1,arg2){ > obj = (typeof arg1 == 'string') ? $('#'+arg1) : $(arg1); > return obj; > }
At some point you're going to bite the bullet and convert all the calling functions to include the '#' right? Hope so. Until then you could just tweak the find method in jQuery and not have to litter those tests all over the place. Try including this code: jQuery.fn._find = jQuery.fn.find; jQuery.fn.find = function(t, context) { if (typeof t == 'string') t = '#' + t; return this._find(t, context); } _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/