Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Usage of Bootstrap Input Groups

What is the role of Input Groups in Bootstrap? What all purposes does it fulfill?



1 Answer
karthikeya Boyini

By adding prepended and appended content to an input field, you can add common elements to the user’s input. For example, you can add the dollar symbol, the @ for a Twitter username, or anything else that might be common for your application interface.

You can try to run the following code to create Bootstrap Input Group

Example

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Input Group</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div style = "padding: 100px 100px 10px;">
         <form class = "bs-example bs-example-form" role = "form">
            <div class = "input-group">
               <span class = "input-group-addon">@</span>
               <input type = "text" class = "form-control" placeholder = "twitterhandle">
            </div>
            <br>
            <div class = "input-group">
               <input type = "text" class = "form-control">
               <span class = "input-group-addon">.00</span>
            </div>
            <br>
            <div class = "input-group">
                span class = "input-group-addon">$</span>
               <input type = "text" class =" form-control">
               <span class = "input-group-addon">.00</span>
            </div>
         </form>
      </div>
   </body>
</html>
Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.