Open In App

jQuery Mobile Textinput create Event

Last Updated : 20 Jan, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. 

In this article, we will be using the jQuery Mobile Textinput create event. This event is triggered when the Textinput widget is created.

Syntax:

Initializing the Textinput create event.

$( ".selector" ).textinput({
  create: function( event, ui ) {}
});
  • Binding an event listener to the textinputcreate event.

    $( ".selector" ).on( "textinputcreate", function( event, ui ) {} );

Parameters: It accepts a callback function that has two parameters.

  • event: It accepts event type value.
  • ui: It accepts Object type value. The ui object can be empty but used for consistency with other events.

CDN Link: 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-1.10.2.min.js”></script>
<script src=”https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js”></script>

Example: This example describes the jQuery Mobile Textinput create event.

HTML




<!doctype html>
<html lang="en">
  
<head>
    <link rel="stylesheet" href=
    <script src=
    </script>
    <script src=
    </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>


Output:

jQuery Mobile Textinput create Event

jQuery Mobile Textinput create Event

Reference: https://api.jquerymobile.com/textinput/#event-create



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads