/    Sign up×
Community /Pin to ProfileBookmark

Make Bold a part of a String

Hi Everybody,

I need to know how is possible in JavaScript make a function able to make bold a part of a string selected in a text field.

Thank since now for the help

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@TheBearMayFeb 24.2005 — Are you wanting to change the bold attribute or????
Copy linkTweet thisAlerts:
@FunPalaceauthorFeb 24.2005 — For instance.....

I've a textarea.......in the text area I'd like to have the possibilities to select only one word and make it bold......
Copy linkTweet thisAlerts:
@PittimannFeb 24.2005 — Hi!

Taking what you said that you want literally, the answer is: you cannot. You can add css properties to a textarea, but only as a whole and not for a part of its' contents. Example:

<textarea style="font-weight:bolder">The whole text here is bold</textarea>

But I assume you want something like [URL=http://www.kevinroth.com/rte/demo.htm]this[/URL].

Cheers - Pit
Copy linkTweet thisAlerts:
@FunPalaceauthorFeb 24.2005 — Hi Pit,

thanks for the answer....

Yes I'd like to have something like that but only for the Bold Function.
Copy linkTweet thisAlerts:
@FangFeb 24.2005 — IE has [URL=http://msdn.microsoft.com/workshop/samples/browser/webediting/onepageeditor.htm]ContentEditable[/URL], but for Mozilla you will need [B]Pit[/B]'s solution. As for Opera no-way
×

Success!

Help @FunPalace spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...