How to allow HTML in Placeholder in Form?

My current code is this:
Placeholder::make('custom_placeholder')
->live()
->content(function (Get $get): string {
$html_code = '<div style="background-color: red;">' . $get('updated_at') . '</div>';
return new HtmlString($html_code);
})
->label(__('My placeholder')),
Placeholder::make('custom_placeholder')
->live()
->content(function (Get $get): string {
$html_code = '<div style="background-color: red;">' . $get('updated_at') . '</div>';
return new HtmlString($html_code);
})
->label(__('My placeholder')),
But the output is escaped so I see <div. .. instead of just the red date. How to make HTML work with placeholder in form?
Solution:
OK, it seems that just changing the return type did the thing.
Jump to solution
1 Reply
Solution
Wirkhof
Wirkhof7mo ago
OK, it seems that just changing the return type did the thing.
Want results from more Discord servers?
Add your server