Tuesday 25 September 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...