![]() |
VOOZH | about |
jQuery Mobile is a web-based technology that can be used to make responsive content for websites that can be accessed on all types of smartphones, tablets, and desktops.
In this article, we are going to learn the jQuery Mobile Collapsibleset option() method. Using this method, we can get, set or update any parameter’s value of the collapsibleset widget. We can also get all the options as key-value pairs using this method.
Syntax:
1. If the user wants any option’s value, the option name should be passed in the option(optionName) method. The optionName should be a string type.
var isEnhanced = $("Selector").collapsibleset("option", "enhanced");
2. To get all the options as the key-value pairs, you just need to call the option() method with no parameter passed to the method.
var options= $("Selector").collapsibleset("option");
3. To set the value of any option, you just need to call the option(optionName, value) with the optionName and the value as the parameters.
$("Selector").collapsibleset("option", "enhanced", "false");
4. We can also set multiple options instead of only one, you just need to call the option(options) method where options are the list of options.
$("Selector").collapsibleset("option", {enhanced: false, disabled: true});
CDN Link: Add the below jQuery Mobile scripts that will be needed for your project.
<link rel=”stylesheet” href=”//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.css”>
<script src=”//code.jquery.com/jquery-3.2.1.min.js”></script>
<script src=”//code.jquery.com/mobile/1.5.0-alpha.1/jquery.mobile-1.5.0-alpha.1.min.js”></script>
Example: This example demonstrates the jQuery Mobile Collapsibleset option() method.
Output:
Reference: https://api.jquerymobile.com/collapsibleset/#method-option