jQuery Mobile Filterable的destroy()方法

jQuery Mobile Filterable的destroy()方法

jQuery UI是一种基于网络的技术,由各种GUI部件、视觉效果和主题组成。这些功能可以使用jQuery JavaScript库来实现。jQuery UI是为网页建立UI界面的最佳工具。它也可以用来建立高度互动的网络应用程序,或者可以用来轻松地添加小工具。

在这篇文章中,我们将使用jQuery Mobile Filterable destroy()方法,从widget中完全删除可过滤功能。这个方法将元素返回到它的预启动状态,这也不接受任何参数。

语法:

$( ".selector" ).filterable( "destroy" );

CDN链接:添加以下jQuery Mobile脚本,这将是你的项目所需要的。

<link rel=”stylesheet” href=”https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css” />
<script src=”http://code.jquery.com/jquery-1.11.0.min.js”></script>
<script src=”https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js”></script>

例子:这个例子演示了jQuery Mobile Filterable destroy()方法。

<!DOCTYPE html>
<html lang="en">
        
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1">
    <link rel="stylesheet"
          href=
"https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
    <script src=
"http://code.jquery.com/jquery-1.11.0.min.js">
    </script>
    <script src=
"https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js">
    </script>    
          
    <script>
        (document).ready(function () {
          
            (".items").filterable({});            
            (".btnclass").bind("click", function () {
                (".items").filterable("destroy");
            });
        });
    </script>
  
</head>
  
<body>
 <center>
        <div data-role="page" id="page1">
            <div>
                <h1 style="color:green;">GeeksforGeeks</h1>
                <h3>
                    jQuery Mobile Filterable destroy() method
                </h3>
            </div>
        
            <div role="main" class="ui-content">
                <div >
                    <ul class="items" style="list-style-type:none;">
                        <li>
                            <a href=
"https://www.geeksforgeeks.org/data-structures"
                            target="_blank">
                                Data Structures
                            </a>
                        </li>
                        <li>
                            <a href=
"https://practice.geeksforgeeks.org/courses/complete-interview-preparation"
                            target="_blank">
                                Interview preparation
                            </a>
                        </li>
                        <li>
                            <a href=
"https://www.geeksforgeeks.org/java"
                            target="_blank">
                                Java Programming
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        
            <input type="button" Value="Destroy" class="btnclass" />
              
            <div id="divID"></div>
        </div>
    </center>
</body>
</html>

输出:

jQuery Mobile可过滤的destroy()方法

jQuery Mobile可过滤的destroy()方法

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程