Pergunta

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?

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top