jQuery UI Helpers / Ajax Forms

The jQuery UI Helpers library is also a jQuery plugin because it extends jQuery with a method called jQueryUIHelpers. Normally you do not need to use this, because adding a script tag with a reference to the jQuery UI Helpers unobtrusive script is enough to properly initialize the jQuery UI widgets.

So why the plugin functionality?

It is useful when you use Ajax calls to load parts of the page and the server returns HTML fragments that contain jQuery UI widgets generated with jQuery UI Helpers. You should initialize these widgets after adding them to the page, like in the following example.

The example uses Ajax to load a form into an element and initializes all the jQuery UI widgets on it.

$(function () {
    $('#loadButton').click(function () {
        $('#container').load('/Docmo/AjaxForms/Form', function () {
            $('#container').jQueryUIHelpers();
        });
    });
});

Click the button to load a form that contains jQuery UI widgets.