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

The Archive Base Latest Questions

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

Can codemirror be used on more than one textarea? I use many textareas that

  • 0

Can codemirror be used on more than one textarea? I use many textareas that are generated dynamically.

<script type="text/javascript"> 
var editor = CodeMirror.fromTextArea('code', {
height: "dynamic",
parserfile: "parsecss.js",
stylesheet: "codemirror/css/csscolors.css",
path: "codemirror/js/"
});
</script>

I would prefer setting a class on the textarea to connect it to codemirror. Is it possible? The Another way of solving it would be to set multiple IDs. The code above sets the ID “code” to connect to codemirror.

  • 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-18T22:41:25+00:00Added an answer on May 18, 2026 at 10:41 pm

    You can actually make multiple calls to CodeMirror.fromTextArea to ‘Codemirror-ify’ multiple textareas.

    If you want multiple textareas with the same options, wrap the Codemirror.fromTextArea call in a function, like:

    function editor(id)
    {
        CodeMirror.fromTextArea(id, {
            height: "350px",
            parserfile: "parsexml.js",
            stylesheet: "css/xmlcolors.css",
            path: "js/",
            continuousScanning: 500,
            lineNumbers: true
        });
    }
    

    You can then apply it to your textareas like:

    editor('code1');
    editor('code2');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How I can save() all CodeMirror textareas on one page?
Can CodeMirror 2 be used to highlight code from a DIV or PRE tag
i try to use codemirror in a jquery ui dialog. here you can see
Can any one tell, how to get the result of LINQ query contains group
I'm writing a page with examples that demonstrate the use of my js library.
Can I run two for loops in one statement in javascript? Would I do
Can someone please show me how can I make a quotation like that (see
I trying to create my component which include Joomla CodeMirror plugin. I filled textarea
Can I call select before recv_from on a socket that is blocking?
Can someone maybe tell me why this is not working? I have used echo

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.