jQuery Mobile - Textinput URL and Password



Description

url input type accepts only URL value. This type is used for input fields that should contain a URL address.

password input type is used to create a hidden text control, it is a field for sensitive information.

Example

Following example demonstrates the use of URL and password input in the jQuery Mobile.

<!DOCTYPE html>
<html>
   <head>
      <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 = "https://code.jquery.com/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
   </head>
   
   <body>
      <form>
         <h2>URL Input Example</h2>
         <label for = "src">URL Input</label>
         <input type = "url" id = "src" data-clear-btn = "false">
         
         <label for = "src1">Clear the URL Field</label>
         <input type = "url" data-clear-btn = "true" id = "src1">

         <h2>Password Input Example</h2>
         <label for = "src2">Password Input</label>
         <input type = "password" id = "src2" data-clear-btn = "false">
         
         <label for = "src3">Clear the Password Field</label>
         <input type = "password" data-clear-btn = "true" id = "src3">
      </form>
   </body>
</html>

Output

Let's carry out the following steps to see how the above code works −

  • Save the above html code as textinput_url_password.html file in your server root folder.

  • Open this HTML file as http://localhost/textinput_url_password.html and the following output will be displayed.

jquery_mobile_widgets.htm
Advertisements