Make part of text field bold

58 views
Skip to first unread message

MonkeyMargie

unread,
Jul 17, 2012, 9:03:16 AM7/17/12
to greasemon...@googlegroups.com
I have a 'Description' field on a page. Using GreaseMonkey, I am inserting a template to help the users enter the correct information in this field. My code, for example, looks like this:
 
thisTextarea.value = 'Version:' + '\n' +
'Type:'+ '\n' + ...
 
Now if I want to make 'Type:' bold, how can I do that? Thanks.

Anthony Lieuallen

unread,
Jul 17, 2012, 9:25:42 AM7/17/12
to greasemon...@googlegroups.com
On Tue, Jul 17, 2012 at 9:03 AM, MonkeyMargie <abc...@gmail.com> wrote:
Now if I want to make 'Type:' bold, how can I do that? Thanks.

Formatting and textareas don't mix.  This has nothing to do with greasemonkey, it's just the way it is.

Hans Henrik Bergan

unread,
Jul 20, 2012, 2:48:20 PM7/20/12
to greasemon...@googlegroups.com
this very chat script at groups.google.com manges to add bold script,, italian script, underscores,
and even color, while writing, to something that looks Allot like a textarea.
so don't give up quite yet, it defiantly is possible (at least to emulate), somehow..


i dont know how they are doing it (tried to check element, seems im writing to a <div></div> rather than a <textarea></textarea> o.0)

best guess would be something close to:
addEventListener('keydown',function(button){ele.text+='<bold>'+button+'</bold>';}}

mike cupcake

unread,
Jul 20, 2012, 4:15:23 PM7/20/12
to greasemon...@googlegroups.com
On Friday, July 20, 2012 7:48:20 PM UTC+1, Hans Henrik Bergan wrote:
this very chat script at groups.google.com manges to add bold script,, italian script, underscores,
and even color, while writing, to something that looks Allot like a textarea.

it's an iFrame containing HTML,  functionally nothing like a textarea element I'm afraid.
Reply all
Reply to author
Forward
0 new messages