I Am creating this submission system right now. I want to create it so that it inserts some text (like [b]
[/b]
) when a div is clicked. This is the sample we're working with:
<div class="insertBBC" title="Bold Text" onClick="moveNumbers([b][/b])" id="bold">
<p>B</p>
</div>
<div class="insertBBC" title="Italic Text">
<p>I</p>
</div>
<div class="insertBBC" title="Bullet Points">
<p>BP</p>
etc...
I also want it so when there is already content in the text field, it will not remove anything from there, also, It should add the [b][/b]
tags where the cursor was at. And when the text is selected, it will place the [b] tag infront of the selection and the [/b] tag at the back. Kind of like BBC
Works. I have no idea how can I achieve any of this, I've researched for quite a while, I see people telling its only possible with JQuery, and I don't know Jquery nor JS yet so yeah.. I'd avoid it if possible.
Also, these are the textboxes. There are two of them and I'd want to insert into the one that is currently active.
<br><textarea name="newPost" placeholder="Post Preview(Will Be Displayed on the Index Page)" cols="100" rows="10"/></textarea><br>
<br><textarea name="newPostPreview" placeholder="Post Text" cols="100" rows="10"/></textarea>
Any leads? Thanks :)