jQuery UI object type for “ui” object passed to the callback function?

前端 未结 1 1191
栀梦
栀梦 2021-02-06 06:33

In jQuery UI, what is the type/contents of the \"ui\" object passed to the callback function of alot of the event methods, and how do I use it?

For example, the \"select

相关标签:
1条回答
  • 2021-02-06 06:46

    From what I understand, (and this is just from making observations and my incredible powers ::cough, cough:: of inference) ui is a object or collection of the elements that are being acted upon within the user interface. In order to access them, you need to pick the one you want to be using, rather than selecting the object as a whole. Eg. in droppable, it's ui.draggable or ui.droppable. In your example, ui.selected is what would work.

    $("#selectable").selectable({
        selected: function(event, ui) {
           $(ui.selected).find("input").attr('checked', true);
        }
    });
    

    Hope that answers your question.

    0 讨论(0)
提交回复
热议问题