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 8529591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:03:58+00:00 2026-06-11T09:03:58+00:00

When a code is typed in like ^1 in a textarea i want the

  • 0

When a code is typed in like ^1 in a textarea i want the font color of any text after that code to be changed to whatever color the ^1 is assigned to,

As of now i have the following:

<form method="post" action="index.php">
<textarea id="text" onkeypressed="changecolor()"></textarea>
<input type="submit" value="Add">
</form>

javascript:

function changecolor() { //code here }

so basically when i type in ^1 and the color blue is assigned to that code, the text after that code will be in the color blue, but when a second code is typed in; example ^2 the text after that will be the color that is assigned to that code,

I know very well how to insert data into a database, but i need to beable to find a way of getting the raw data; i.e the data that was orginally typed into the textarea with the codes like ^1 and ^2

Help is really appreciated!

  • 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-11T09:03:59+00:00Added an answer on June 11, 2026 at 9:03 am

    You cant target specific fragments of text in a textarea. What you want to do can’t be done of my knowing, unless you monitor its content and add an abstract div layer to output styled html from it.
    Many wysiwyg text editors do it like this, or use the ‘contenteditable’ attribute to allow html editing in modern browsers…
    You can start like this:

    <script type="text/javascript">
        var display, input, displayHtml;
        function init(){
           display = document.getElementById('display');
           input = document.getElementById('input');
        }
        function onContentChange(){
            displayHtml = parseContent(this.value);
            display.innerHtml = displayHtml;
        }
        function parseContent(text){
            var html = ... // Generate html according to content
            return html;
        }
        document.onload=init;
    </script>
    

    html:

    <textarea id='input' onkeypress="javascript:onContentChange" />
    <div id='display'></div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the following code to change font text of whatever typed in
I have code that I want to look like this: List<Type> Os; ... foreach
I want to have script reference code like this displayed in a textarea so
I want to get some HTML code that are in textarea apply some function
The Problem I'm receiving crash reports from users that look like this: Code Type:
I found some old Python code that was doing something like: if type(var) is
I have HTML code like below <input type = textarea id=sentence1> Here is my
For instance, I want to have a html form that looks like this: <table>
I have a bit of HTML code that I would like to change based
I want to rewrite this code to Backbone.js, how should I do that? app/assets/javascripts/views/plots/plots_index.js.coffee

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.