I know that there are other question addressing this issue but they mostly cover adding a value to an attribute based on a variable. I want to include several attributes and their values based on a condition.
My first attempt, as you can see below, besides not working is not very readable:
<input
type="text"
{{ $errors->has('bedrooms') ? "data-toggle='tooltip' data-placement='right'
title='please, enter a value between 1 and 9.'" : "" }}
/>
Produces the html:
<input type="text"
data-toggle="tooltip" data-placement="right"
title="please, enter a value between 1 and 9." />
Change your blade syntax to {!! !!}
<input type="text"
{!! $errors->has('bedrooms') ? "data-toggle='tooltip' data-placement='right' title='please, enter a value between 1 and 9.'" : "" !!}
/>
By default, Blade escape Html - See the documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With