how do i add permanent place holder inside input filed

你说的曾经没有我的故事 提交于 2019-12-08 05:45:50

问题


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


回答1:


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.

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.



来源:https://stackoverflow.com/questions/29817834/how-do-i-add-permanent-place-holder-inside-input-filed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!