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

  • Home
  • SEARCH
  • 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 7000579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:41:24+00:00 2026-05-27T20:41:24+00:00

I am creating a small HTML editor using jQuery. I have created my own

  • 0

I am creating a small HTML editor using jQuery. I have created my own button-icons for:

  • bold
  • italics
  • underline
  • insert hyperlink
  • insert image
  • unordered list
  • ordered list

But I donot know how to get it working. My idea:

  • bold: when user clicks on this button, selected text in the editor box() should be replaced with <b> ..selected_text.. </b>. Otherwise, insert <b></b> at cursor position.

  • italic: when user clicks on this button, selected text in the editor box() should be replaced with <i> ..selected_text.. </i>. Otherwise, insert <i></i> at cursor position.

  • same as above for Underline

  • etc….

So my question is, how to get the selected text from TEXTAREA and how to replace it with the tags? And also, how to insert a text at cursor position (ie. at that blinking line) ?

This is same as the buttons present in Stackoverflow’s editor, when you post some questions. (for example, try clicking on the BOLD button in Stackoverflow’s editor, when you have selected a text and when not selected)

  • 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-05-27T20:41:25+00:00Added an answer on May 27, 2026 at 8:41 pm

    I strongly recommend using a JavaScript library which smooths out the cross-browser differences when working with ranges and selections: Rangy.

    A cross-browser JavaScript range and selection library. It provides a simple standards-based API for performing common DOM Range and Selection tasks in all major browsers, abstracting away the wildly different implementations of this functionality between Internet Explorer and DOM-compliant browsers.

    For manipulating selections in <textarea> and <input type="text"> elements, see see Rangy’s poorly-named and svelter twin project, Rangyinputs.


    How to get the selected text from TEXTAREA and how to replace it with the tags?

    Check out the Rangy CSS Class Applier Module (and associated demo page).

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

Sidebar

Related Questions

I am creating a small application using HTML 5, Javascript and Google Maps API
I'm creating a small web page using jquery-ui-1.8 which is having a frameset and
I have started creating small applications in Java using Net-beans, i was trying to
I'm currently creating a very small form on my homepage using HTML and JavaScript.
I am creating a small app to teach myself ASP.NET MVC and JQuery, and
I'm creating a small jQuery plugin for my CMS that styles certain form input
I'm creating a small server using java.nio , but when trying to stress test
I'm creating a small web application. The application have several screens (list, inner list,
I am new to CSS and have a small problem.I am creating a news
I'm creating a small app using python 2.7 with google app engine and I'm

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.