Skip to content
Advertisement

How to write html tag inside blade form object label..?

I have to write “Name * : “, where astrix will be red. i am creating label as:

    {!! Form::label("name","Name".<span class="red">*</span>." :") !!}

But this will result in:Name with html tag span tag.

thanks

Advertisement

Answer

For this you have to pass an array. Something like below:

{!! Form::label("name", "Name:", array('class' => 'require') !!}

And style this require class below way. Hope this should work.

.require:after{ 
    content:'*'; 
    color:red; 
}

Another way, UPDATED:

I think, this one you looking for. Use double quotes in span and inner style use single quotes.

{!! Form::label('name', 'Name:'),"<span style='color:red'>*</span>" !!}

This should work.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement