在表单的输入字段中单独占位符文本,中间是输入字符串 [英] Separate placeholder text in form's input field with input string in the middle

查看:155
本文介绍了在表单的输入字段中单独占位符文本,中间是输入字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Rails应用中有一个带有占位符的表单字段。当您专注于表单时,我想分割占位符,以便表单的实际输入位于它之间。所以例如占位符就像:

I have a form field in my Rails app with a placeholder. I'd like to divide the placeholder when you focus on the form so that the actual input of the form sits in between it. So for example the placeholder would be like:

Placeholder "input string" placeholder

我想把这个领域塑造成:

I'd like to fashion the field so that:


  1. 单击它会将光标放在占位符之间的输入处。

  2. 输入的任何文本都不会溢出占位符的其余部分。

这可能吗?

推荐答案

您是否考虑过以下内容:

Have you considered something like:

<label for="foo">Placeholder 
  <input id="foo" name="foo" value="input string"> placeholder</label>

结合CSS使输入流与周围的文本一起?需要零javascript并且无处不在。

combined with CSS to make the input flow with the surrounding text? Requires zero javascript and works everywhere.

这篇关于在表单的输入字段中单独占位符文本,中间是输入字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆