Tuesday, September 25, 2018

Create a HTML span as a text using java / javascript

I need to induce a style property (color) to a selected text in a html div. This html div is created dynamically and is not accessible as a DOM element. Is there a way to do this ?




I have tried this : - inducing a html span (having the required style) along with the selected text.



      String data="hello";
String sig= "its me !!"+" + data +
"
";
widget.setData(sig);


I need the data alone in orange color. The widget internally handles the dynamic creation of the required div.




The characters "<" and ">" is converted to "<" and ">" and is shown as text instead of the span element. Is there a way to fix this. ?



Is there any way to inject HTML as string?

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...