jQuery Mobile is a web technology used to make responsive websites and apps which are accessible on smartphones, tablets, and desktop devices. In this article, we will be using the jQuery Mobile Flipswitch disable() method to disable the flip switch enabled widget. This method does not accept any parameter.
Syntax:
$(".selector").flipswitch("disable");
Parameters: This method does not accepts any parameters.
CDN Links: First, add jQuery Mobile scripts needed for your project.
<link rel=”stylesheet” href=”https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css” />
<script src=”https://code.jquery.com/jquery-2.1.3.js”></script>
<script src=”https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js”></script>
Example: This example describes the jQuery Mobile Flipswitch disable() method.
HTML
<!doctype html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
< meta name = "viewport"
content = "width=device-width, initial-scale=1" >
< link rel = "stylesheet"
href =
< script src =
</ script >
< script src =
</ script >
< script >
$(document).ready(function() {
$("#btn").on('click', function() {
$("#GFG").flipswitch("disable");
})
});
</ script >
</ head >
< body >
< center >
< div data-role = "page" >
< div data-role = "header" >
< h1 >GeeksforGeeks</ h1 >
< h3 >jQuery Mobile Flipswitch disable() Method</ h3 >
</ div >
< div class = "ui-field-contain" >
< form >
< div data-role = "fieldcontain" >
< label for = "GFG" >
Flipswitch Checkbox:
</ label >
< input type = "checkbox"
id = "GFG"
data-role = "flipswitch" >
</ div >
</ form >
</ div >
< input type = "button"
id = "btn"
style = "width: 250px;"
value = "Disable the Widget" >
</ div >
</ center >
</ body >
</ html >
|
Output:

Reference: https://api.jquerymobile.com/flipswitch/#method-disable
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
13 Jan, 2023
Like Article
Save Article