How can I change the current text style at the current position of the cursor without chnaging the whole div id's font style?

document.getElementById('message').style.fontWeight='bold';

This changes all the previous text styling in the textarea i have been trying to find a way aboutit but can't seem to find one??

You need to look into range selection; however, IE & FF & Chrome are not the same. For FF & Chrome, search the Internet for window.getSelection(). For IE, search for document.selection.createRange().

thanks i will do tomorrow going to get some zzzz its 3am here now I will let you know how i get on with it

I haven't solved this thread I have been messing around all day with this it would seen a textarea doesn't allow formatting of fonts unless one color or one style is selected unless you display the <html></html> tags so I am going to close this thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.