how to add anchor tag to selected text using javascript | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to add anchor tag to selected text using javascript

I have to add anchor tag to selected text in textarea how to do that. I got one link where tag can be added but i need to add anchor tag . https://stackoverflow.com/questions/19374071/how-to-add-tag-to-selected-text-using-javascript

29th Apr 2022, 11:05 AM
Jayashree M
8 Answers
+ 1
But how? <textarea> doesn't support anchors, it only supports text. In case <textarea> value was "Lorem ipsum" and user select word "ipsum", how should it be?
29th Apr 2022, 4:08 PM
Ipang
+ 1
Adding <a> to a textarea is pointless. The hyperlink won't work no matter how. Tell me more about your idea, I don't know what to suggest until it's clear what you actually want to do.
30th Apr 2022, 7:41 AM
Ipang
+ 1
Did the e-mail get sent successfully? more specifically, did the hyperlinks work? Can you save the code in SoloLearn and share its link? I hope people can understand you better after they see your code and thus they can suggest something appropriately. I see you already asked this topic 3 months ago, and someone had answered you back then. Did you try the suggestion? how did it work?
30th Apr 2022, 12:52 PM
Ipang
0
Maybe this might help You change the variable data ( "<" + tag + ">" ) to something like this include the <a href="#"> link text </a>
29th Apr 2022, 12:44 PM
Aminu Muhammed
Aminu Muhammed - avatar
0
Aminu Muhammed- I have tried but if i change as u told nothing is working thank u for help
30th Apr 2022, 6:05 AM
Jayashree M
0
Ipang- I'm new to php i need to get hyperlink that are clickable so i thought of adding anchor tag inside textarea is there any alternative that help me a lot thanks
30th Apr 2022, 6:17 AM
Jayashree M
0
Ipang-I am try to send mail through Form using php where i need to send Meeting links or location where it accept text and links combing and convert it into a hyperlinks that has to be clickable so i thought of using textarea
30th Apr 2022, 10:18 AM
Jayashree M
0
Ipang- Email sent successfully it only works for sending one Hyperlink and i have added code. I have asked this question before also but i have restriction that i have to use php mail() itself nothing else so i am asking again but need to send more than one hyperlink is that possible to send ? https://code.sololearn.com/wT6rTR3fOW96
2nd May 2022, 12:35 PM
Jayashree M