I'm starting with Laravel and I'm using Illuminate/Html for making forms.
I want to add disabled attribute to the first option and I dont find the way to do it.
{!! Form::open(['url' => 'shelter/pets']) !!}
<div class="form-group">
{!! Form::label('pet_type','Type:') !!}
{!! Form::select('pet_type', ['Select Type','dog', 'cat'], 0, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::submit('Add pet', null, ['class' => 'btn btn-primary form-control']) !!}
</div>
{!! Form::close() !!}
Just pass the disabled
in the options
. Try with -
{!! Form::select('pet_type', ['Select Type','dog', 'cat'], 0, ['class' => 'form-control', 'disabled' => true]) !!}
You can do it manually looping through the array in php or by using jquery.
$('select.someclass option:first').attr('disabled', true);