Add span-tags around the text(string), that included in an object
up vote
5
down vote
favorite
Hi I'm trying to change the background color of the text that is included an the object. I'm trying it in vuejs.
I've text(string) and some data(object).
My requirement is, if the word is included in the object. Then I need to change the background color of that particular word.
From the response I'll get the text like this:
text: "Pavan'snPavannKumar Dasireddy isntrying tonaddnthe span tagnto the textn That isn in an Object."
.
Calling the nb2html(this.theText)
function in the <span id="test" v-html="nb2html(this.text)"> </span>
for replacing the n
with <br>
tag.
After Replacing with <br>
I can see the UI as below:
So, when the page loaded the included text should be highlighted with some background color.
sanbox link: Sandbox link
Eg: In the below code, Kumar is included in the object, so I need to change the background color for Kumar only.
I tried mapping the object and checking the text with myObject.includes(
${searchText})
.
If includes then tried to replace the text with the <span style="background-color: yellow">${searchText}</span>
.
But span tag not adding to the text.Here is my code sample:
<template>
<span>
<el-row type="flex">
<el-col>
<el-card>
<span id="test" v-html="nb2html(this.text)">
</span>
</el-card>
</el-col>
</el-row>
</span>
</template>
<script>
export default {
name: 'samplefile',
data() {
return {
theText: '',
text: "Pavan'snPavannKumar Dasireddy isntrying tonaddnthe span tagnto the textn That isn in an Object.",
myObject: {
name: 'Kumar',
trying: 'add',
isGood: 'the text which is on tag form of',
mobile: '9874563210',
concept: 'trying',
user:'Pavan',
}
};
},
watch: {
document: 'caluclateBoundingBoxes',
selectedText: 'hideContextMenu',
},
mounted() {
this.caluclateBoundingBoxes();
},
methods() {
nb2html(text) {
const mainText = text.replace(/n/g, '<br>');
this.theText = mainText;
Object.keys(this.myObject).map((key, index) => {
const searchText = `${this.myObject[key]}`;
const n = this.theText.includes(`${searchText}`);
console.log(`index:${index}`, `${key}: ${searchText}`, n, 'position:', this.theText.indexOf(`${searchText}`), 'length:', searchText.length);
const repText = `<span style="background-color: yellow">${searchText}</span>`;
this.theText = this.theText.replace(/${searchText}/i, repText);
return this.theText;
});
return this.theText;
},
caluclateBoundingBoxes() {
if (this.myObject) {
this.myObject = JSON.parse(JSON.stringify(this.myObject));
console.log('the text is:', this.theText);
console.log(this.myObject);
}
},
}
}
</script>
Please suggest me the possible way to achieve this. Thanks!!
javascript html css vue.js wrapping
add a comment |
up vote
5
down vote
favorite
Hi I'm trying to change the background color of the text that is included an the object. I'm trying it in vuejs.
I've text(string) and some data(object).
My requirement is, if the word is included in the object. Then I need to change the background color of that particular word.
From the response I'll get the text like this:
text: "Pavan'snPavannKumar Dasireddy isntrying tonaddnthe span tagnto the textn That isn in an Object."
.
Calling the nb2html(this.theText)
function in the <span id="test" v-html="nb2html(this.text)"> </span>
for replacing the n
with <br>
tag.
After Replacing with <br>
I can see the UI as below:
So, when the page loaded the included text should be highlighted with some background color.
sanbox link: Sandbox link
Eg: In the below code, Kumar is included in the object, so I need to change the background color for Kumar only.
I tried mapping the object and checking the text with myObject.includes(
${searchText})
.
If includes then tried to replace the text with the <span style="background-color: yellow">${searchText}</span>
.
But span tag not adding to the text.Here is my code sample:
<template>
<span>
<el-row type="flex">
<el-col>
<el-card>
<span id="test" v-html="nb2html(this.text)">
</span>
</el-card>
</el-col>
</el-row>
</span>
</template>
<script>
export default {
name: 'samplefile',
data() {
return {
theText: '',
text: "Pavan'snPavannKumar Dasireddy isntrying tonaddnthe span tagnto the textn That isn in an Object.",
myObject: {
name: 'Kumar',
trying: 'add',
isGood: 'the text which is on tag form of',
mobile: '9874563210',
concept: 'trying',
user:'Pavan',
}
};
},
watch: {
document: 'caluclateBoundingBoxes',
selectedText: 'hideContextMenu',
},
mounted() {
this.caluclateBoundingBoxes();
},
methods() {
nb2html(text) {
const mainText = text.replace(/n/g, '<br>');
this.theText = mainText;
Object.keys(this.myObject).map((key, index) => {
const searchText = `${this.myObject[key]}`;
const n = this.theText.includes(`${searchText}`);
console.log(`index:${index}`, `${key}: ${searchText}`, n, 'position:', this.theText.indexOf(`${searchText}`), 'length:', searchText.length);
const repText = `<span style="background-color: yellow">${searchText}</span>`;
this.theText = this.theText.replace(/${searchText}/i, repText);
return this.theText;
});
return this.theText;
},
caluclateBoundingBoxes() {
if (this.myObject) {
this.myObject = JSON.parse(JSON.stringify(this.myObject));
console.log('the text is:', this.theText);
console.log(this.myObject);
}
},
}
}
</script>
Please suggest me the possible way to achieve this. Thanks!!
javascript html css vue.js wrapping
Since I can't run the snippet, could you add the output ofthis.theText
andthis.myObject
to the question?
– peresleguine
Nov 9 at 10:34
@peresleguine,Thanks for the reply, modified the question. Please check it and let me know if need more information.
– Pavan kumar Dasireddy
Nov 9 at 10:48
add a comment |
up vote
5
down vote
favorite
up vote
5
down vote
favorite
Hi I'm trying to change the background color of the text that is included an the object. I'm trying it in vuejs.
I've text(string) and some data(object).
My requirement is, if the word is included in the object. Then I need to change the background color of that particular word.
From the response I'll get the text like this:
text: "Pavan'snPavannKumar Dasireddy isntrying tonaddnthe span tagnto the textn That isn in an Object."
.
Calling the nb2html(this.theText)
function in the <span id="test" v-html="nb2html(this.text)"> </span>
for replacing the n
with <br>
tag.
After Replacing with <br>
I can see the UI as below:
So, when the page loaded the included text should be highlighted with some background color.
sanbox link: Sandbox link
Eg: In the below code, Kumar is included in the object, so I need to change the background color for Kumar only.
I tried mapping the object and checking the text with myObject.includes(
${searchText})
.
If includes then tried to replace the text with the <span style="background-color: yellow">${searchText}</span>
.
But span tag not adding to the text.Here is my code sample:
<template>
<span>
<el-row type="flex">
<el-col>
<el-card>
<span id="test" v-html="nb2html(this.text)">
</span>
</el-card>
</el-col>
</el-row>
</span>
</template>
<script>
export default {
name: 'samplefile',
data() {
return {
theText: '',
text: "Pavan'snPavannKumar Dasireddy isntrying tonaddnthe span tagnto the textn That isn in an Object.",
myObject: {
name: 'Kumar',
trying: 'add',
isGood: 'the text which is on tag form of',
mobile: '9874563210',
concept: 'trying',
user:'Pavan',
}
};
},
watch: {
document: 'caluclateBoundingBoxes',
selectedText: 'hideContextMenu',
},
mounted() {
this.caluclateBoundingBoxes();
},
methods() {
nb2html(text) {
const mainText = text.replace(/n/g, '<br>');
this.theText = mainText;
Object.keys(this.myObject).map((key, index) => {
const searchText = `${this.myObject[key]}`;
const n = this.theText.includes(`${searchText}`);
console.log(`index:${index}`, `${key}: ${searchText}`, n, 'position:', this.theText.indexOf(`${searchText}`), 'length:', searchText.length);
const repText = `<span style="background-color: yellow">${searchText}</span>`;
this.theText = this.theText.replace(/${searchText}/i, repText);
return this.theText;
});
return this.theText;
},
caluclateBoundingBoxes() {
if (this.myObject) {
this.myObject = JSON.parse(JSON.stringify(this.myObject));
console.log('the text is:', this.theText);
console.log(this.myObject);
}
},
}
}
</script>
Please suggest me the possible way to achieve this. Thanks!!
javascript html css vue.js wrapping
Hi I'm trying to change the background color of the text that is included an the object. I'm trying it in vuejs.
I've text(string) and some data(object).
My requirement is, if the word is included in the object. Then I need to change the background color of that particular word.
From the response I'll get the text like this:
text: "Pavan'snPavannKumar Dasireddy isntrying tonaddnthe span tagnto the textn That isn in an Object."
.
Calling the nb2html(this.theText)
function in the <span id="test" v-html="nb2html(this.text)"> </span>
for replacing the n
with <br>
tag.
After Replacing with <br>
I can see the UI as below:
So, when the page loaded the included text should be highlighted with some background color.
sanbox link: Sandbox link
Eg: In the below code, Kumar is included in the object, so I need to change the background color for Kumar only.
I tried mapping the object and checking the text with myObject.includes(
${searchText})
.
If includes then tried to replace the text with the <span style="background-color: yellow">${searchText}</span>
.
But span tag not adding to the text.Here is my code sample:
<template>
<span>
<el-row type="flex">
<el-col>
<el-card>
<span id="test" v-html="nb2html(this.text)">
</span>
</el-card>
</el-col>
</el-row>
</span>
</template>
<script>
export default {
name: 'samplefile',
data() {
return {
theText: '',
text: "Pavan'snPavannKumar Dasireddy isntrying tonaddnthe span tagnto the textn That isn in an Object.",
myObject: {
name: 'Kumar',
trying: 'add',
isGood: 'the text which is on tag form of',
mobile: '9874563210',
concept: 'trying',
user:'Pavan',
}
};
},
watch: {
document: 'caluclateBoundingBoxes',
selectedText: 'hideContextMenu',
},
mounted() {
this.caluclateBoundingBoxes();
},
methods() {
nb2html(text) {
const mainText = text.replace(/n/g, '<br>');
this.theText = mainText;
Object.keys(this.myObject).map((key, index) => {
const searchText = `${this.myObject[key]}`;
const n = this.theText.includes(`${searchText}`);
console.log(`index:${index}`, `${key}: ${searchText}`, n, 'position:', this.theText.indexOf(`${searchText}`), 'length:', searchText.length);
const repText = `<span style="background-color: yellow">${searchText}</span>`;
this.theText = this.theText.replace(/${searchText}/i, repText);
return this.theText;
});
return this.theText;
},
caluclateBoundingBoxes() {
if (this.myObject) {
this.myObject = JSON.parse(JSON.stringify(this.myObject));
console.log('the text is:', this.theText);
console.log(this.myObject);
}
},
}
}
</script>
Please suggest me the possible way to achieve this. Thanks!!
<template>
<span>
<el-row type="flex">
<el-col>
<el-card>
<span id="test" v-html="nb2html(this.text)">
</span>
</el-card>
</el-col>
</el-row>
</span>
</template>
<script>
export default {
name: 'samplefile',
data() {
return {
theText: '',
text: "Pavan'snPavannKumar Dasireddy isntrying tonaddnthe span tagnto the textn That isn in an Object.",
myObject: {
name: 'Kumar',
trying: 'add',
isGood: 'the text which is on tag form of',
mobile: '9874563210',
concept: 'trying',
user:'Pavan',
}
};
},
watch: {
document: 'caluclateBoundingBoxes',
selectedText: 'hideContextMenu',
},
mounted() {
this.caluclateBoundingBoxes();
},
methods() {
nb2html(text) {
const mainText = text.replace(/n/g, '<br>');
this.theText = mainText;
Object.keys(this.myObject).map((key, index) => {
const searchText = `${this.myObject[key]}`;
const n = this.theText.includes(`${searchText}`);
console.log(`index:${index}`, `${key}: ${searchText}`, n, 'position:', this.theText.indexOf(`${searchText}`), 'length:', searchText.length);
const repText = `<span style="background-color: yellow">${searchText}</span>`;
this.theText = this.theText.replace(/${searchText}/i, repText);
return this.theText;
});
return this.theText;
},
caluclateBoundingBoxes() {
if (this.myObject) {
this.myObject = JSON.parse(JSON.stringify(this.myObject));
console.log('the text is:', this.theText);
console.log(this.myObject);
}
},
}
}
</script>
<template>
<span>
<el-row type="flex">
<el-col>
<el-card>
<span id="test" v-html="nb2html(this.text)">
</span>
</el-card>
</el-col>
</el-row>
</span>
</template>
<script>
export default {
name: 'samplefile',
data() {
return {
theText: '',
text: "Pavan'snPavannKumar Dasireddy isntrying tonaddnthe span tagnto the textn That isn in an Object.",
myObject: {
name: 'Kumar',
trying: 'add',
isGood: 'the text which is on tag form of',
mobile: '9874563210',
concept: 'trying',
user:'Pavan',
}
};
},
watch: {
document: 'caluclateBoundingBoxes',
selectedText: 'hideContextMenu',
},
mounted() {
this.caluclateBoundingBoxes();
},
methods() {
nb2html(text) {
const mainText = text.replace(/n/g, '<br>');
this.theText = mainText;
Object.keys(this.myObject).map((key, index) => {
const searchText = `${this.myObject[key]}`;
const n = this.theText.includes(`${searchText}`);
console.log(`index:${index}`, `${key}: ${searchText}`, n, 'position:', this.theText.indexOf(`${searchText}`), 'length:', searchText.length);
const repText = `<span style="background-color: yellow">${searchText}</span>`;
this.theText = this.theText.replace(/${searchText}/i, repText);
return this.theText;
});
return this.theText;
},
caluclateBoundingBoxes() {
if (this.myObject) {
this.myObject = JSON.parse(JSON.stringify(this.myObject));
console.log('the text is:', this.theText);
console.log(this.myObject);
}
},
}
}
</script>
javascript html css vue.js wrapping
javascript html css vue.js wrapping
edited Nov 22 at 6:47
asked Nov 9 at 10:12
Pavan kumar Dasireddy
404112
404112
Since I can't run the snippet, could you add the output ofthis.theText
andthis.myObject
to the question?
– peresleguine
Nov 9 at 10:34
@peresleguine,Thanks for the reply, modified the question. Please check it and let me know if need more information.
– Pavan kumar Dasireddy
Nov 9 at 10:48
add a comment |
Since I can't run the snippet, could you add the output ofthis.theText
andthis.myObject
to the question?
– peresleguine
Nov 9 at 10:34
@peresleguine,Thanks for the reply, modified the question. Please check it and let me know if need more information.
– Pavan kumar Dasireddy
Nov 9 at 10:48
Since I can't run the snippet, could you add the output of
this.theText
and this.myObject
to the question?– peresleguine
Nov 9 at 10:34
Since I can't run the snippet, could you add the output of
this.theText
and this.myObject
to the question?– peresleguine
Nov 9 at 10:34
@peresleguine,Thanks for the reply, modified the question. Please check it and let me know if need more information.
– Pavan kumar Dasireddy
Nov 9 at 10:48
@peresleguine,Thanks for the reply, modified the question. Please check it and let me know if need more information.
– Pavan kumar Dasireddy
Nov 9 at 10:48
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
I don't use vue.js here and perhaps you have different logic, but hopefully this plain javascript snippet could help:
var myText = "Pavan's Pavan Kumar Dasireddy is trying to add the span tag to the text that is in an Object."
var myObject = {
name: 'Kumar',
trying: 'add',
isGood: 'the text which is on tag form of',
mobile: '9874563210',
concept: 'trying',
user:'Pavan'
}
var result = myText.split(' ').map(function(word) {
if (Object.values(myObject).includes(word)) {
return '<span class="yellow">' + word + '</span>'
} else {
return word
}
})
var e = document.getElementById('result')
e.innerHTML = result.join(' ')
.yellow {
background-color: yellow;
}
<div id="result"></div>
If the above snippet is unavailable check this codepen.
Please check my sanbox once: codesandbox.io/s/z66jzp0x74
– Pavan kumar Dasireddy
Nov 9 at 11:36
@PavankumarDasireddy, sorry, I've not tried Vue yet but I'm sure you can adapt plain javascript for your use case.
– peresleguine
Nov 9 at 11:59
Thanks @peresleguine, for your valuable time and for the code.
– Pavan kumar Dasireddy
Nov 9 at 12:07
add a comment |
up vote
0
down vote
Adding this
as a second argument to map
should fix this:
Object.keys(this.myObject).map((key, index) => {
...
}, this)
There is a scope issue where the this
in map
declaration is not scoped to the Vue component.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I don't use vue.js here and perhaps you have different logic, but hopefully this plain javascript snippet could help:
var myText = "Pavan's Pavan Kumar Dasireddy is trying to add the span tag to the text that is in an Object."
var myObject = {
name: 'Kumar',
trying: 'add',
isGood: 'the text which is on tag form of',
mobile: '9874563210',
concept: 'trying',
user:'Pavan'
}
var result = myText.split(' ').map(function(word) {
if (Object.values(myObject).includes(word)) {
return '<span class="yellow">' + word + '</span>'
} else {
return word
}
})
var e = document.getElementById('result')
e.innerHTML = result.join(' ')
.yellow {
background-color: yellow;
}
<div id="result"></div>
If the above snippet is unavailable check this codepen.
Please check my sanbox once: codesandbox.io/s/z66jzp0x74
– Pavan kumar Dasireddy
Nov 9 at 11:36
@PavankumarDasireddy, sorry, I've not tried Vue yet but I'm sure you can adapt plain javascript for your use case.
– peresleguine
Nov 9 at 11:59
Thanks @peresleguine, for your valuable time and for the code.
– Pavan kumar Dasireddy
Nov 9 at 12:07
add a comment |
up vote
0
down vote
I don't use vue.js here and perhaps you have different logic, but hopefully this plain javascript snippet could help:
var myText = "Pavan's Pavan Kumar Dasireddy is trying to add the span tag to the text that is in an Object."
var myObject = {
name: 'Kumar',
trying: 'add',
isGood: 'the text which is on tag form of',
mobile: '9874563210',
concept: 'trying',
user:'Pavan'
}
var result = myText.split(' ').map(function(word) {
if (Object.values(myObject).includes(word)) {
return '<span class="yellow">' + word + '</span>'
} else {
return word
}
})
var e = document.getElementById('result')
e.innerHTML = result.join(' ')
.yellow {
background-color: yellow;
}
<div id="result"></div>
If the above snippet is unavailable check this codepen.
Please check my sanbox once: codesandbox.io/s/z66jzp0x74
– Pavan kumar Dasireddy
Nov 9 at 11:36
@PavankumarDasireddy, sorry, I've not tried Vue yet but I'm sure you can adapt plain javascript for your use case.
– peresleguine
Nov 9 at 11:59
Thanks @peresleguine, for your valuable time and for the code.
– Pavan kumar Dasireddy
Nov 9 at 12:07
add a comment |
up vote
0
down vote
up vote
0
down vote
I don't use vue.js here and perhaps you have different logic, but hopefully this plain javascript snippet could help:
var myText = "Pavan's Pavan Kumar Dasireddy is trying to add the span tag to the text that is in an Object."
var myObject = {
name: 'Kumar',
trying: 'add',
isGood: 'the text which is on tag form of',
mobile: '9874563210',
concept: 'trying',
user:'Pavan'
}
var result = myText.split(' ').map(function(word) {
if (Object.values(myObject).includes(word)) {
return '<span class="yellow">' + word + '</span>'
} else {
return word
}
})
var e = document.getElementById('result')
e.innerHTML = result.join(' ')
.yellow {
background-color: yellow;
}
<div id="result"></div>
If the above snippet is unavailable check this codepen.
I don't use vue.js here and perhaps you have different logic, but hopefully this plain javascript snippet could help:
var myText = "Pavan's Pavan Kumar Dasireddy is trying to add the span tag to the text that is in an Object."
var myObject = {
name: 'Kumar',
trying: 'add',
isGood: 'the text which is on tag form of',
mobile: '9874563210',
concept: 'trying',
user:'Pavan'
}
var result = myText.split(' ').map(function(word) {
if (Object.values(myObject).includes(word)) {
return '<span class="yellow">' + word + '</span>'
} else {
return word
}
})
var e = document.getElementById('result')
e.innerHTML = result.join(' ')
.yellow {
background-color: yellow;
}
<div id="result"></div>
If the above snippet is unavailable check this codepen.
var myText = "Pavan's Pavan Kumar Dasireddy is trying to add the span tag to the text that is in an Object."
var myObject = {
name: 'Kumar',
trying: 'add',
isGood: 'the text which is on tag form of',
mobile: '9874563210',
concept: 'trying',
user:'Pavan'
}
var result = myText.split(' ').map(function(word) {
if (Object.values(myObject).includes(word)) {
return '<span class="yellow">' + word + '</span>'
} else {
return word
}
})
var e = document.getElementById('result')
e.innerHTML = result.join(' ')
.yellow {
background-color: yellow;
}
<div id="result"></div>
var myText = "Pavan's Pavan Kumar Dasireddy is trying to add the span tag to the text that is in an Object."
var myObject = {
name: 'Kumar',
trying: 'add',
isGood: 'the text which is on tag form of',
mobile: '9874563210',
concept: 'trying',
user:'Pavan'
}
var result = myText.split(' ').map(function(word) {
if (Object.values(myObject).includes(word)) {
return '<span class="yellow">' + word + '</span>'
} else {
return word
}
})
var e = document.getElementById('result')
e.innerHTML = result.join(' ')
.yellow {
background-color: yellow;
}
<div id="result"></div>
edited Nov 9 at 11:35
answered Nov 9 at 11:28
peresleguine
1,51822227
1,51822227
Please check my sanbox once: codesandbox.io/s/z66jzp0x74
– Pavan kumar Dasireddy
Nov 9 at 11:36
@PavankumarDasireddy, sorry, I've not tried Vue yet but I'm sure you can adapt plain javascript for your use case.
– peresleguine
Nov 9 at 11:59
Thanks @peresleguine, for your valuable time and for the code.
– Pavan kumar Dasireddy
Nov 9 at 12:07
add a comment |
Please check my sanbox once: codesandbox.io/s/z66jzp0x74
– Pavan kumar Dasireddy
Nov 9 at 11:36
@PavankumarDasireddy, sorry, I've not tried Vue yet but I'm sure you can adapt plain javascript for your use case.
– peresleguine
Nov 9 at 11:59
Thanks @peresleguine, for your valuable time and for the code.
– Pavan kumar Dasireddy
Nov 9 at 12:07
Please check my sanbox once: codesandbox.io/s/z66jzp0x74
– Pavan kumar Dasireddy
Nov 9 at 11:36
Please check my sanbox once: codesandbox.io/s/z66jzp0x74
– Pavan kumar Dasireddy
Nov 9 at 11:36
@PavankumarDasireddy, sorry, I've not tried Vue yet but I'm sure you can adapt plain javascript for your use case.
– peresleguine
Nov 9 at 11:59
@PavankumarDasireddy, sorry, I've not tried Vue yet but I'm sure you can adapt plain javascript for your use case.
– peresleguine
Nov 9 at 11:59
Thanks @peresleguine, for your valuable time and for the code.
– Pavan kumar Dasireddy
Nov 9 at 12:07
Thanks @peresleguine, for your valuable time and for the code.
– Pavan kumar Dasireddy
Nov 9 at 12:07
add a comment |
up vote
0
down vote
Adding this
as a second argument to map
should fix this:
Object.keys(this.myObject).map((key, index) => {
...
}, this)
There is a scope issue where the this
in map
declaration is not scoped to the Vue component.
add a comment |
up vote
0
down vote
Adding this
as a second argument to map
should fix this:
Object.keys(this.myObject).map((key, index) => {
...
}, this)
There is a scope issue where the this
in map
declaration is not scoped to the Vue component.
add a comment |
up vote
0
down vote
up vote
0
down vote
Adding this
as a second argument to map
should fix this:
Object.keys(this.myObject).map((key, index) => {
...
}, this)
There is a scope issue where the this
in map
declaration is not scoped to the Vue component.
Adding this
as a second argument to map
should fix this:
Object.keys(this.myObject).map((key, index) => {
...
}, this)
There is a scope issue where the this
in map
declaration is not scoped to the Vue component.
edited Nov 9 at 13:49
answered Nov 9 at 10:36
Shawn Janas
1,86811010
1,86811010
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53223732%2fadd-span-tags-around-the-textstring-that-included-in-an-object%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Since I can't run the snippet, could you add the output of
this.theText
andthis.myObject
to the question?– peresleguine
Nov 9 at 10:34
@peresleguine,Thanks for the reply, modified the question. Please check it and let me know if need more information.
– Pavan kumar Dasireddy
Nov 9 at 10:48