romman
romman

Reputation: 211

how do i add permanent place holder inside input filed

i need to add font-icon inside input field so i used this method

 <input type="text" name="your name" placeholder="&#xe00b; YOUR NAME" style="font-family:Flaticon" class="restrict">

as you see placeholder="&#xe00b; YOUR NAME" this &#xe00b; display font-icon but my problem is when user types some text place holder disapper so i need font icon to be placed permanent inside input field like <lable>

can someone help me

Upvotes: 2

Views: 5455

Answers (1)

tjati
tjati

Reputation: 6079

You can't. What do you expect it to look like? placeholder disappears by design.

If you want to prefix an icon in front of your input field, put them together in a container, give this container the needed style and put there your icon and your input-tag. That's the way, how bootstrap your problem solves.

Example of bootstrap.

Shortened example:

<div class="input-group">
  <div class="input-group-addon">$</div>
  <input type="text" class="form-control" id="exampleInputAmount" placeholder="Amount">
</div>

Of course, you need CSS.

Upvotes: 2

Related Questions