+ 1

How reply button works in sololearn?

whenever we click a reply button, the name of the person to whom we wanna reply to gets pre-populated in the text area. How this works? I wanna achieve the same functionality in HTML textarea. Is it possible?

23rd Apr 2022, 6:16 PM
Sandeep
Sandeep - avatar
10 Antworten
+ 4
Sandeep, I see, well, if you only want to see a name in the textarea then Akshay has a working example. But I'm not sure whether a textarea can contain hyperlink in the text, that is if you want the person name to act as hyperlink like mentions in SoloLearn : )
24th Apr 2022, 6:11 AM
Ipang
+ 2
Yes you can do something similar. If running on SoloLearn, the program can not exit to remember data. If running elsewhere, you can store the data in Cookies. SoloLearn's data is proprietary and you have agreed to not reference it without their consent.
24th Apr 2022, 2:46 AM
John Wells
John Wells - avatar
+ 2
Ipang what I wanna do is pre-fill the textarea in html with some text to be precise. https://code.sololearn.com/W163lFcw9oPy/?ref=app Currently, this textarea is empty.
24th Apr 2022, 3:11 AM
Sandeep
Sandeep - avatar
+ 2
Sandeep you can achieve this by using innerHTML property of textarea element. Like this https://code.sololearn.com/WYynxAoNVmeD/?ref=app
24th Apr 2022, 3:32 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 2
Sandeep I am answering your question here which you have asked in comment of the code. Yes Ipang , textarea cannot contain any other HTML element inside it. But there is a way to do so by setting attribute value of `contenteditable` to true of a div tag. And now we can add other HTML element in it also. Sandeep, In the code now you can see the name appear in bold and other text as normal. (I have modified my previous code) But I am not sure it is a good practice or not? 🤔
24th Apr 2022, 6:56 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
+ 2
Ipang i have an idea for making it work as a link. Using the AKSHAY🇮🇳 method I can just add a hidden input tag with the id of the user and using that I can convert the mention to link before showing it.
24th Apr 2022, 7:52 AM
Sandeep
Sandeep - avatar
+ 2
thanx :]
24th Apr 2022, 8:57 AM
Sandeep
Sandeep - avatar
+ 2
You need css and javascript to make buttons work. html is only to create the elements, css to style, and javascript to code the functions
24th Apr 2022, 1:54 PM
devcmd
devcmd - avatar
+ 1
Can you add a link to your code in post's Description above? it would help others to better understand what you are trying to achieve, how you're doing it, and what needs to be corrected. https://www.sololearn.com/post/75089/?ref=app
23rd Apr 2022, 9:29 PM
Ipang
+ 1
Sandeep no need of adding more element you can just change contenteditable to false. So the div just behave as a normal div with containing a hyperlink text. Check the code again: https://code.sololearn.com/WYynxAoNVmeD/?ref=app
24th Apr 2022, 8:26 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar