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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:48:55+00:00 2026-06-09T01:48:55+00:00

I have users copying content from random webpages and pasting into a SharePoint 2010

  • 0

I have users copying content from random webpages and pasting into a SharePoint 2010 RTE. Unbeknownst to them, they are also copying styles from the original webpages that the RTE converts to styled span tags and those span tags are overriding the default text styling on the page. Upon paste, I’d like to automatically remove any/all span tags but keep any remaining markup. I realize that there will be other related issues but removing the span tags will get me much closer to where I need to be.

I’ve found a code snippet here that removes all markup upon paste.

//Disable the RTE paste option. Restricts to "Paste Plain Text" 
function disableMarkupPasteForRTE()
{
 Type.registerNamespace("RTE");
 if (RTE)
 {
  if(RTE.RichTextEditor != null)
  {
   RTE.RichTextEditor.paste = function() { RTE.Cursor.paste(true); }
   // Handle Ctrl+V short cut options in rich text editor
   RTE.Cursor.$3C_0 = true;
  }
 }
}

_spBodyOnLoadFunctionNames.push("disableMarkupPasteForRTE");

Is anyone able to modify the above code to only remove span tags?

  • 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-09T01:48:56+00:00Added an answer on June 9, 2026 at 1:48 am

    The SharePoint RTE is nothing more than a suped-up ContentEditable div. The solution is to bind a function onpaste to the editor and then manipulate the html directly.

    $(document).ready(function() {
        $(".ms-rtestate-write").bind('paste', function(e) {
            var text = $(this).html();
            $(this).html(text.replace( /<\s*span.*?>/gi,"").replace( /<\s*\/\s*span\s*.*?>/gi,""));
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have following code for copying content of vector into file #include<iterator> #include<algorithm> #include<fstream>
I have users that require to copy and paste from word (or excel) into
I have users selecting a DateTime using a caldendar/clock popup that allows them to
i have users table and i have posts table i want select from users
I have users who write articles and when they leave there computer for a
I have a protected worksheet that users would like to copy and paste into.
I have users table and want to SELECT some rows by bitmask criteria. I'll
I have users table. There are three other tables: developers, managers, testers. All of
I have users that have several objects and can upload images for those objects.
In my application I have Users, Organisations and Employees. There are domain objects for

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.