3 Years
Discussion Span
Last Post by JorgeM

Can you provide more information about what exactly it is that you need help with? The title of your post is related to previewing. If all you need is to preview something that is within a textbox, you can do so with JavaScript. how do you want it to be previewed (by clicking, onkeypress)?

Post your relevant code, describe the issue you are having to help solve your problem.


yes jorgem you got my point.i want to create a textarea and a button by which i can make the selected text bold.


Do you have any HTML code written yet? I think this can be easily done via JavaScript.

My thought is display a textarea element, a button, and then a div for the preview.

Call a function when you click on a button, and in the function use the values of the selectionStart and selectionEnd properties of the textarea and assign that to a string. Then take the string and wrap that string with <b> tags for bold, display it in the preview div...


I don't think you can directly show the bold effect in the textarea. As JorgeM mentioned, you should manipulate the content in a seperate div tag or paragraph in order to display the change. So you should have another button called preview textarea.

Edited by cmps

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.