在Laravel 4中使用HTML占位符 [英] Using HTML Placeholder in Laravel 4

查看:52
本文介绍了在Laravel 4中使用HTML占位符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

{{ Form::text('username', Input::old('username')) }}

这是我的代码,我想在文本框中添加用户名作为占位符.我已经在项目中使用了引导程序.

This is my code, I want to add Username as placeholder in the text box. I already use bootstrap in the project.

我尝试使用示例

{{ Form::text('username', 'Username', Input::old('username')) }}

但是它提供了一个默认值,需要将其删除,然后用户必须键入他的值.我想要类似Twitter.com等上显示的内容.一旦用户输入该内容,该内容就会被删除.

But it gives a default value which needs to be deleted and then the user has to type his value. I want something like how it shows up on Twitter.com etc. Which gets erased once user types into it.

推荐答案

{{ Form::text('username', Input::old('username'),  array('placeholder'=>'Username')) }}

这适用于Laravel 4!

This works for Laravel 4!!

这篇关于在Laravel 4中使用HTML占位符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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