Using HTML Placeholder in Laravel 4

harishannam picture harishannam · Jun 30, 2013 · Viewed 26.1k times · Source
{{ 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.

I tried to use the example

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

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.

Answer

harishannam picture harishannam · Jun 30, 2013
{{ Form::text('username', Input::old('username'),  array('placeholder'=>'Username')) }}

This works for Laravel 4!!