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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:06:10+00:00 2026-05-29T11:06:10+00:00

I have a textarea that I want to paste different text formats into. What

  • 0

I have a textarea that I want to paste different text formats into. What would be ideal is to have several buttons each with a different kind of label.. One button to paste format A, another to paste format B… Each of these formats is just text. the JavaScript psuedocode for these would be:

function pasteFormatA() {
   var txt = clipboard.getTextContent();
   if(txt) {
       // sanitize text
       // then put in textarea
   }
}

Is that possible? Using Chrome, but cross browser solution would be better.

  • 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-29T11:06:10+00:00Added an answer on May 29, 2026 at 11:06 am

    Reading the actual clipboard would be a violation of browser sandboxing. The best you can do is to sanitize the content after it is pasted.

    This is a jQuery example of filtering based on active button pressed.

    http://jsfiddle.net/xjTUY/1

    <button class="active">A</button><button>B</button><button>C</button>
    <br />
    <br />
    <textarea></textarea>
    
    $('button').click(function() {
        $('button').removeClass('active');
        $(this).addClass('active');
    });
    
    $('textarea').bind('input propertychange', function() {
        var text = $(this).val();
        var activeFilter = $('button.active').html();
        switch (activeFilter) {
        case 'A':
            $(this).val(text.replace('a', ''));
            break;
        case 'B':
            $(this).val(text.replace('b', ''));
            break;
        case 'C':
            $(this).val(text.replace('c', ''));
            break;
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a variable that contains text information (say taken from a textarea),
I have textarea. Now, I want to do that once you write #q +
I have a field that I'm outputting text into after doing an nl2br(). I've
I have a textarea that contains phone numbers, each number in a separate line.
I want to select every textarea that does not have a DIV with class
I have a page with radio buttons and a textarea that populates data dynamically
I have a textarea that I want to fill up the entire screen. Everyway
I have set a default value in textarea. I want that when someone clicks
I have a textarea that I want to enable vertical scrolling. When I exceed
I have a textarea that I need to put a new line into with

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.