문제

Looking at the jQuery UI v1.9 API documentation (http://api.jqueryui.com/1.9/datepicker/#method-option), it says:

option()

Returns: PlainObject

Gets an object containing key/value pairs representing the current datepicker options hash. This signature does not accept any arguments.

The documented code example is:

var options = $( ".selector" ).datepicker( "option" );

This doesn't work for me. It should return a PlainObject, but it's returning a jQuery object holding a single item; the input element.

Am I doing something wrong? Is the documentation wrong? Have I found a bug?

도움이 되었습니까?

해결책

A colleague of mine found the answer to this. I think the documentation is wrong.

To return the options you need to pass 'all' as the second parameter:

var options = $( ".selector" ).datepicker( "option", "all" );

I eventually found a forum post about it too: http://forum.jquery.com/topic/jquery-datepicker-option-method-does-not-retrieve-options-correctly

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top