Welcome Guest, Not a member yet? Register   Sign In
How to add icons to inputs?
#1

How can I add a prepend icon or an append icon to an input box using form_input() in PHP? The current code I have only includes basic properties like name, value, id, placeholder, and class. I want to add a bootstrap 3 styling to the input box such as a prepend icon or an append icon, for example: <span class="input-group-addon" id="basic-addon2">@example.com</span>. I have checked the CI3 manual but could not find any specific information. Any suggestions or solutions would be appreciated.
Reply
#2

READ:

CSS to put icon inside an input element in a form
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(This post was last modified: 04-13-2023, 12:44 AM by JustJohnQ.)

If you want to prepend or append an icon to a text input, you can use the following code (when using bootstrap):
Code:
<div class="input-group">
   <span class="input-group-addon">@</span>
   <input type="text" class="form-control" placeholder="Username">
</div>
or, although not tested, using the form_input method:
Code:
<div class="input-group">
   <span class="input-group-addon">@</span>
   <?php echo form_input($fielddata); ?>
</div>
Reply




Theme © iAndrew 2016 - Forum software by © MyBB