jQuery Mobile 是一种基于网络的技术,用于制作可在所有智能手机、平板电脑和台式机上访问的响应式内容。
在本文中,我们将使用 jQuery Mobile Textinput 创建事件。创建 Textinput 小部件时会触发此事件。
用法:
初始化文本输入创造事件。
$( ".selector" ).textinput({
  create: function( event, ui ) {}
});
- 
将事件监听器绑定到文本输入创建事件。
$( ".selector" ).on( "textinputcreate", function( event, ui ) {} ); 
参数:它接受具有两个参数的回调函数。
- event: 它接受事件类型值。
 - ui:它接受对象类型值。 ui 对象可以为空,但用于与其他事件保持一致。
 
CDN 链接:首先,添加项目所需的 jQuery Mobile 脚本。
<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-1.10.2.min.js”></script>
<script src=”https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js”></script>
例子:此示例说明了 jQuery Mobile文本输入 创造事件。
HTML
<!doctype html> 
<html lang="en"> 
  
<head> 
    <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-1.10.2.min.js"> 
    </script> 
    <script src= 
"https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"> 
    </script> 
</head> 
  
<body> 
    <center> 
        <div data-role="page"> 
            <h1 style="color:green;"> 
                GeeksforGeeks 
            </h1> 
            <h3>jQuery Mobile Textinput  
                create Event</h3> 
            <div id="log"></div> 
            <div data-role="header"> 
            </div> 
            <div role="main" class="ui-content" 
                 style="width: 50%;"> 
                <label for="GFG">Enter Text:</label> 
                <textarea name="Geeks" id="GFG"></textarea> 
            </div> 
        </div> 
    </center> 
    <script> 
        $(document).ready(function () { 
            $("#GFG").textinput({ 
                create: function (event, ui) { } 
            }); 
            $("#GFG").on("textinputcreate",  
                         function (event, ui) { }); 
            $("#log").html( 
              'Textinput widget has been created.' 
            ); 
        }); 
    </script> 
</body> 
  
</html>输出:

jQuery Mobile Textinput 创建事件
参考:https://api.jquerymobile.com/textinput/#event-create
相关用法
- jQuery Mobile Textinput clearBtnText用法及代码示例
 - jQuery Mobile Textinput enable()用法及代码示例
 - jQuery Mobile Textinput destroy()用法及代码示例
 - jQuery Mobile Textinput option()用法及代码示例
 - jQuery Mobile Textinput disable()用法及代码示例
 - jQuery Mobile Textinput wrapperClass用法及代码示例
 - jQuery Mobile Textinput initSelector用法及代码示例
 - jQuery Mobile Toolbar destroy()用法及代码示例
 - jQuery Mobile Toolbar updatePagePadding()用法及代码示例
 - jQuery Mobile Toolbar option()用法及代码示例
 - jQuery Mobile Toolbar refresh()用法及代码示例
 - jQuery Mobile Toolbar enable()用法及代码示例
 - jQuery Mobile Toolbar toggle()用法及代码示例
 - jQuery Mobile Toolbar disable()用法及代码示例
 - jQuery Mobile Toolbar show()用法及代码示例
 - jQuery Mobile Toolbar hide()用法及代码示例
 - jQuery Mobile Toolbar backBtnTheme用法及代码示例
 - jQuery Mobile Table defaults用法及代码示例
 - jQuery Mobile Toolbar tapToggleBlacklist用法及代码示例
 - jQuery Mobile Toolbar disabled用法及代码示例
 - jQuery Mobile Toolbar updatePagePadding用法及代码示例
 - jQuery Mobile Toolbar trackPersistentToolbars用法及代码示例
 - jQuery Mobile Toolbar supportBlacklist用法及代码示例
 - jQuery Mobile Toolbar disablePageZoom用法及代码示例
 - jQuery Mobile Toolbar hideDuringFocus用法及代码示例
 
注:本文由纯净天空筛选整理自Kanchan_Ray大神的英文原创作品 jQuery Mobile Textinput create Event。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
