Appending styled text
See original GitHub issueIssue Description
Informations
what i need to do is to append html elements and text such as :
var bold = document.createElement("b");
var italic = document.createElement("i");
var underline = document.createElement("u");
var text= document.createTextNode("hi");
italic.appendChild(bold);
bold.appendChild(text);
underline.appendChild(italic);
now i have to insert it into editor.
I am making smth for transcribing, so this would be used on key cmd to insert some kind of text.
for inserting regular text, without style, I used this function
// adds Speaker's id into the editor
function addSpeaker(savedID){
if(savedID==null){
return;
} else{
var x = document.execCommand('insertHTML', false, savedID);
console.log(byId('editor'));
console.log(x);
}
}
I tried
// Set HTML content
trumbowyg.html('<p>Your content here</p>');
all the possibilities, but none of them works.
help?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Using .append() + css/styling to add new text using Jquery ...
You can't add style to text, you need to create a new element, either a DIV or a SPAN, and put the style...
Read more >How to style some appended text on page - Sololearn
pls how do i style appended stuffs on a page using javascript i tried using (classList and the .style method but its not...
Read more >How to Append or Add text to a DIV element using JavaScript
I have shared two examples here explaining how to add or append text to a div element dynamically using javascript.
Read more >Styled Text Field - the Draftbit Docs!
The Styled Text Field is a single line and gives you the ability to add labels for each Text Field. Adding Styled Text...
Read more >Appending Style Nodes with Javascript | Jon Raasch's Blog
Here we created a style node in the DOM and added type="text/css" . If you need to attach a media attribute, simply add:...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
regardless your utterly sarcastic attitude, thank you for your absolutely useless comment which does not at all responds to my question. I want to append elements in html, not insert in it.
Keep cool. I anwser to many issues each days on my free time. You are unclear. So I did not understand your point.
Without sarcasm:
I want to help you but Idk how since I do not get your need.
Note: please, next time, use markdown to color your code.