18 AnswersNew Answer
18 AnswersNew Answer
Erm. document.getElementById("textareaid").value += "\nNew Line";
Oh. I changed Para.innerHTML = document.getElementById("MyText").value; to Para.innerHTML = "<pre>" + document.getElementById("MyText").value + "</pre>" It works until you press find Es. The solution will be to remove the "<pre>" and "</pre>" tags from the p.innerHTML, then replace it. Let me see what I can do.
...I was mid paragraph explaining 😂😂😂 It works perfectly if we change p to pre 😅 Well, we both learn something new today!
No need to use pre Just add .replace(/\n/g, "<br\>"); to force the text with new lines. https://code.sololearn.com/WvduhrtFCNta/?ref=app
Yes..this works too. https://code.sololearn.com/WcS1n6coUZjY/?ref=app Note however, if you press the find buttin multiple times. the yellowness around the e gets larger. That's because you need to take out the span each time as well.
Well, you can use the replace to replace the spans. I'll see what I can do.
Remodified yet again. Just type away.
Oh. Forgot to link it https://code.sololearn.com/WcS1n6coUZjY/?ref=app
And I fixed that too. xD I'm sure there is a better way, but for now here's this. Maybe Calviղ will come along and fix it I dunno.
It just occurred to me that we're using replace several times in the same line of code If I had known we could do that, I wouldn't have had a few of my problems xD
I mean in the output of the code. I want MyPara to display the line breaks from MyText. Is this possible?
https://code.sololearn.com/W45hTSA3zAqO/?ref=app Here's the code for editing. I'll see if I can figure anything out.
Can you add comments to explain your changes? I'm new to coding and I want to understand rather than just imitate.
I googled the HTML pre tag and why didn't we just replace the paragraph tag with the pre tag
I actually wanted to find a way to make it only add 1 span, because I was hoping to have it instantly find the E's as you type, but I settled for a button because it kept adding spans.
That makes it replace every e with a lowercase e again XD I have to go now. I'll try to figure it out after work.
Learn Playing. Play Learning
SoloLearn Inc.4 Embarcadero Center, Suite 1455
Send us a message