Calling jQuery UI Plugin Methods - J Query

Problem
You need to make a jQuery UI plugin do something programmatically.

Solution

Call the jQuery UI plugin name method, and pass the name of the plugin method you want to call as the first argument. For example, to close a dialog, use this:

If the method takes arguments, pass them after the name of the method. For example, to select the third tab, use this:

Discussion

Every jQuery UI plugin provides at least four common base methods:

  • option

  • enable

  • disable

  • destroy

The option method was covered in the previous recipe. The destroy method is covered in a later recipe. The enable and disable methods are pretty self-explanatory. These work by setting the disabled option for that plugin, which defaults to false:

Calling these methods also toggles the ui-pluginname-disabled class on the element, which can be used for styling or selecting.
To see whether a plugin is currently disabled, use the option method to get the value of the disabled option:
var is Disabled = $('#tempature').slider('option', 'disabled');


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

J Query Topics