Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7910847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:01:31+00:00 2026-06-03T13:01:31+00:00

I have jquery that generates textareas with different id’s. Now i need to make

  • 0

I have jquery that generates textareas with different id’s. Now i need to make some buttons that will format text inside that textareas. For example: when user clicks in certain textarea, enter text, and click “bold” button, only text inside of that textarea will become bold (in other will be normal). I did manage to make something like this with JS, but it was too primitive (text was formated in all of textboxes) 🙁
Here is some sample code for this:

<button id="bold">B</button>
<textarea id="ta_1">Some test text</textarea>
<textarea id="ta_2">Some test text</textarea>

What i want to say: one button, multiply text boxes. Entering text in ta_1 and clicking bold, should bold only text in that txtarea. Additional info: all id’s starting with same word, just different number at the end.

I feel there is some simple solution, just cant figure it out 😀

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T13:01:34+00:00Added an answer on June 3, 2026 at 1:01 pm

    Actually this is a really bad practice, but you can do that like this,

    var activeEl;
    
    $("textarea").focus(function() {
      activeEl = $(this);
    });
    
    $("#bold").click(function() {
      $("textarea").css("font-weight", "");
      activeEl.css("font-weight","bold");
    });
    

    ​
    ​
    DEMO

    UPDATE-1: I don’t know why you are trying to do this, but I suggest to you use a WYSIWYG Editor like elRTE

    UPDATE-2 : You can costomize your toolbar in elRTE, if you want your editor has just a “bold” button, yes you can do that,

    $(document).ready(function() {
        elRTE.prototype.options.panels.web2pyPanel = ['bold'];
        elRTE.prototype.options.toolbars.web2pyToolbar = ['web2pyPanel'];
        var opts = {
            toolbar: 'web2pyToolbar',
        }
        var rte = $('#our-element').elrte(opts);
    });​
    

    DEMO FOR elRTE

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some php code that generates a random password. Next to a text
Right now I have some code that generates <li> elements that have a height
I have this jquery code that generates a yes/no dialog box when the user
I have a jQuery preloader that is loaded in my html file: <script type=text/javascript>
I have some jquery code that i want to able to drag, drop, clone
I have a PHP script that generates a list of places and I need
I have an Android application that generates some HTML which is rendered locally, in
I have a script that generates img tags, and i want to make sure
I have a page that pulls an external JavaScript file, which then generates some
In a text box, as you type, we have autocomplete that generates a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.