As per the documentation :
.data(name, value)
is the setter : it attachesvalue
to thename
key.data(name)
is the getter : it returns the value attached to thename
key
In this case, the value is an object (which stores data about the autocomplete instance bound to the node), and this object is modified in place.
It is a common pattern in the jQuery library to have a function trigger different actions depending on its arguments :
$(selector).click(myFunction)
binds a handler to the nodes,$(selector).click()
triggers theclick
event- in jquery-ui,
$sel.widget('option', name, value)
will generally allow you to change an option after a widget has been created,$sel.widget('option', name )
will allow you to get the value - etc ...