1

I have a value stored as <b> supposed to be bold </b> in mysql.

while fetching through php I used nearly all html entity related functions but no avail

//will be returned as json for vue 
  $item ['value'] = $fetched_data;

in vue template I use like this

{{$value}}

and it gives me as html tags where I am supposed to print the bolded text, anything should I do in PHP or Vue to make this happen?

1
  • A good example of where a template system does 'helpful' things at the wrong time. Escaping the HTML is a feature that can come back and cause problems when you actually don't want it. Commented Aug 4, 2017 at 14:39

1 Answer 1

3

You can use v-html="value" on the element which needs to contain your value.

https://v2.vuejs.org/v2/guide/syntax.html#Raw-HTML

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.