如何在<input>标记中显示文本而不截断,该标记由框架创建

cod*_*Man 21 javascript jquery autocomplete angularjs angular-material

我正在使用Angular Material,并且这个表单有一个自动完成字段,我正在md-autocomplete使用它

<input type = "text" />
Run Code Online (Sandbox Code Playgroud)

在内部渲染文本字段.我遇到了这个问题.每当文本长于字段的宽度时,我希望它包装,以便它不被截断,并显示在下一行中.

但是<input>没有办法设置样式,以便在下一行显示溢出文本(我知道textarea符合我的要求,但md-autocomplete使用input).

所以问题是如何在没有截断的情况下显示文本.任何建议都可以.请帮忙!

Neh*_*ain 3

我认为输入类型=“文本”是不可能的,但作为解决方法,您可以在输入中使用标题属性并具有与值相同的内容。例如

<input type="text" title="something that exceeds the width of the box" value="something that exceeds the width of the box">
Run Code Online (Sandbox Code Playgroud)

这将确保您的内容在悬停时完全可见。