I have setup summer-note.js on my textarea in my Laravel view, if I input any data and include {{}}
this in the data and hit save button, the post saves successfully, but when I go to the show route the page is not loading at all after that I inspected it the body element was only showing, but when I viewed page source all code was displaying there, then I added a new data without {{}}
, then I went to the show route, the page was loading fine, but when I include {{}}
in the data, page doesn't load anymore, my Laravel view code:
<div class="col-md-8">
<h1>Question # {{ $question->id }}:</h1>
<p>{!! $question->question !!}</p>
</div>
I think it is due to double {{ {{ }} }}
because when it renders data it becomes {{ This is {{question}} #1 }} so is there any fix of it?
I tried both {!! $question->question !!}
and {{ $question->question }}
but page was not loading.
Try to use jquery's replaceWith() function and put a restriction in there to convert the {{ }} to a HTML entity whenever it's found in the input.
HTML entity for { is {
and for } is }
For more information, visit replaceWith() function and for HTML entities visit here