views:

109

answers:

1

I'm trying to control positioning of a jQuery datepicker element. I like the solution offered at http://stackoverflow.com/questions/1818670/how-to-control-positioning-of-jqueryui-datepicker for overriding the _checkOffset fn:

$.extend(window.DP_jQuery.datepicker,{_checkOffset:function(inst,offset,isFixed){return offset}});

However, this results in a 'window.DP_jQuery is undefined' error. Upon inspection, I can see that the DP_jQuery object in the DOM gets named with a random string, like so: DP_jQuery_123456. If I use this full name in the above code, it works wonderfully.

My question is whether there's a way to exend the _checkOffset fn for a datepicker instance without knowing before-hand what the instance name is? For example, can I use some sort of wildcard to select all datepicker instances that begin with 'DP_jQuery_'?

Thanks

+1  A: 

Okay, I figured this out. The best way to do this is like so:

$.extend($.datepicker,{_checkOffset:function(inst,offset,isFixed){return offset}});

If I understand correctly, window.DP_jQuery_123456 is a pointer to the object/function $.datepicker. So it's simply easiest to extend the actual object, rather than try to figure out the name of the pointer to the object.

JaredC