jQuery UI Checkboxradio Widget
The checkboxradio widget can be used to take input from the user. The major difference between the traditional checkboxradio button and the one in jQuery UI is the ease with which it can stylize the button. This widget allows working around that limitation by positioning the associated label on top of the hidden input and emulating the checkbox or radio element itself using an (optional) icon.
- destroy: It is used to remove the checkboxradio functionality of jQuery UI and change it to standard checkbox without any styling.
- disable: Disables the checkboxradio buttons.
- enable: Enables the checkboxradio button if it has been previously disabled.
- instance: Returns the checkbox’s last instance object if there is no object selected, it returns undefined.
- refresh: Used to refresh the appearance of the widget, useful after changing and applying different themes.
- widget: Returns the complete checkboxradio as a jQuery widget object.
Example 1: Let us create a simple checkbox radio with a basic theme, Here is the code for this.
Applying a theme: The theme can be changed by changing the CSS file. Here, some predefined CSS files have been used in jQuery UI. The change in the CSS file being called inside the head tag.
Note: In the above example r2 and c2 are the id’s of the div tag. For applying it to a class add “$” before class name.
Here we have used the theme “le-frog”. As it has been specified in this line.
<link rel=’stylesheet’ href=’https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/le-frog/jquery-ui.css’>
Please Login to comment...