I have store data in database text field like this :
<p><strong>Relish Scrumptious Dessert Delights with Baskin Robbins Gift
Voucher</strong></p><span>good</span><div>any rendom text</div> and so on..
So now when I print this data in front end then it should be remove HTML tag only show main content of field but no, it's show me same data that I store in database because it's taking it as a string means when I'm fetching data from database it's add double quotes at beginning and end of the data so it's read as a string and show me same data as I have in database.
I check using inspect element and show that it adds double quotes automatically so for testing I have removed double quotes using inspect element and all data is showing correctly.
I tried to replace double quotes with space using jquery when page load but my actual data don't contain any double quotes so jquery function is not replacing anything.
I tried hard to explain my problem I hope you guys will understand my problem and someone let me know the solution for this weird problem that I'm facing.
UPDAT
BrandController.php
public function get_brand_api(){
$select = "SELECT
b.*,
GROUP_CONCAT(bp.p_name) AS price,
GROUP_CONCAT(bp.p_skuId) AS sku,
GROUP_CONCAT(bp.p_type) AS type,
GROUP_CONCAT(bp.p_valueType) AS valuetype
FROM
brands AS b
LEFT JOIN
brand_price AS bp ON b.hash = bp.hash
WHERE b.slug = :slug GROUP BY b.brand_id
";
$sth = $this->connection->prepare($select);
$sth->bindParam(":slug", $slug);
$sth->setFetchMode(PDO::FETCH_ASSOC);
$sth->execute();
$status = $sth->fetchAll();
return $status;
}
brand_detail.blade.php
<div id="container_detail">
<brand-detail></brand-detail>
</div>
<template id="brand-detail-template">
<div class="content">
<h1> @{{d.brand_name}} </h1>
<img :src="d.image" class="">
</div>
@{{d.description}} // HERE I AM GETTING HTML TAGS WITH DATA.
</template>
brand_detail.js
Vue.component('brand-detail', {
template: '#brand-detail-template',
data: function(){
return {
detail: []
}
},
created: function(){
//var slug = this.$route.params.slug;
var slug = window.location.pathname.split("/").pop();
var url = window.location.protocol + "//" + window.location.host + "/";
var api_url = url + 'gift_india/brand_detail/' + slug;
var that = this
axios.get(api_url)
.then(function (response) {
//console.log(response.data);
that.detail = response.data;
})
.catch(function (error) {
console.log(error.data);
});
},
filters: {
removehtml: function (value) {
if (!value) return ''
var myContent = value;
return myContent.replace(/(<([^>]+)>)/ig,"");
},
strtoarr: function (value) {
var array = JSON.parse("[" + value + "]");
return array;
}
}
});
new Vue({
el: '#container_detail'
})
above blade template code is related Vue js so there is some rendom tags and template.