paul.mearing Posted March 20, 2006 Share Posted March 20, 2006 Hi,I've seen on sites how you can have a normal input button which allows you to insert text into the box. I want to have a button that will insert a html tag where ever the cursor is in the text area. I.e. if i have just typed a URL, I would like to be able to highlight this and then click on the hyperlink button. this would insert the h ref tag and closed tag and the start and finsish so this becomes a link.Is this possible just using javascript / html, or would i need to find a rich text editor like what is used when you add a new topic / post??Would appreciate your input,CheersPaul. Quote Link to comment https://forums.phpfreaks.com/topic/5337-using-text-area/ Share on other sites More sharing options...
Gast Posted March 23, 2006 Share Posted March 23, 2006 Not sure exactly how to have it so that when you select the text and then click the button it adds tags around it, but you can do this:[code]<input type="button" value="HREF Tag" onclick="document.getElementById('textareaid').value = document.getElementById('textareaid').value + '<a href=\"\"></a>'" />[/code]Or something similar. Quote Link to comment https://forums.phpfreaks.com/topic/5337-using-text-area/#findComment-19901 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.