I'd like to know if it's easy to create a simple text editor with only two functions. When highlighting a word or sentence the user will be able to select by clicking a button if this is <h2> or <p>..
afraid I don't understand what you mean. What's the difference between highlighting and selecting?
i mean...there are only two buttons (options)...<p> and <h2> so when the user clicks on one, the highlighted text should be put inside <p> or <h2>... savvy?
Use ranges. Theres differences between browsers but this article covers it quite good: http://www.quirksmode.org/dom/range_intro.html
Ok. I'll have a look at it...thanks