Customizing individual textareas in tinyMCE can easily be done by adjusting the

This resource provides instructions on customizing features like the menubar and status bar for all form fields within tinyMCE:

tinymce.init({
    selector: "textarea",
    menubar:false,
    statusbar: false,
    ..
});

I am wondering how to achieve this customization for individual text areas. For instance, I want some text areas to have a status bar while others do not.

Answer №1

To customize each textarea element, you must assign it a unique id and reference that id in the configuration settings:

tinymce.init({
    selector: "textarea#editor1",
    menubar:false,
    statusbar: false,
    ...
});

<textarea id="editor1"></textarea>

tinymce.init({
    selector: "textarea#editor2",
    // standard toolbar for editor 2
    ...
});

<textarea id="editor2"></textarea>

// Repeat this pattern for additional textareas...

By specifying the textarea's id in the configuration, you specify which textarea the settings apply to. Check out an advanced example on the tinyMCE site for more details:

selector: "textarea#elm1",
Selects only the textarea with ID elm1

UPDATE

It is indeed possible to handle multiple textarea ids simultaneously by setting each one as unique like so:

    <script type="text/javascript">
        tinymce.init({
            selector: "textarea#common1,textarea#common2",
            theme: "modern",
            height: 100,
            menubar:false,
            statusbar: false
        });

        tinymce.init({
            selector: "textarea#comment_toolbox",
            theme: "modern",
            height: 100,
            toolbar: false
        });                     
    </script>
</head>
<body>
    <div width="100%" height="100%">
        <textarea id="common1"></textarea>
        <br/>
        <textarea id="comment_toolbox"></textarea>
        <br/>
        <textarea id="common2"></textarea>
        <br/>           
    </div>
</body>

Your website will display correctly with these arrangements.

Answer №2

this code snippet is inspired by pasty's earlier response. It focuses on maintaining the DRY (Don't Repeat Yourself) principle:

this.initializeEditorSettings = function() {
    var basicElements = ['eobjs','emats','eprocs','eclos','ehoms'];
    var advancedElements = ['comment_box'];

    var convertToSelectors = function(elements) {
        return $.map(elements, function(element) {
            return "textarea#"+element;
        });
    };
    var basicElementSelectors = convertToSelectors(basicElements);
    var advancedElementSelectors = convertToSelectors(advancedElements);

    tinymce.init({
        selector: basicElementSelectors.join(','),
        menubar: false,
        statusbar: false
    })

    tinymce.init({
        selector: advancedElementSelectors.join(','),
        menubar: false,
        statusbar: false,
        toolbar: false
    })

};

Answer №3

To implement this feature, you can utilize the following selector:

$('textarea#mytext').tinymce({
 menubar:false,
 statusbar: false,
 ..
});

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What are the different ways in which :style is utilized in re-frame - with brackets, curly brackets, or simply without any characters?

For my current project, I am utilizing Clojure, ClojureScript, lein, shadow-cljs, Emacs, and CIDER to develop a dynamic web application. Typically, when building the project, I initiate the command cider-jack-in-cljs in Emacs, select shadow-cljs, opt for ...

ReactJS component experiencing issues with loading images

In my React project, there is a directory containing several images, and I am attempting to import them all into a carousel using Bootstrap. The current code looks like this: import Carousel from 'react-bootstrap/Carousel'; const slideImagesFold ...

Changing the background color using ReactJS

After streamlining my project to focus on the main issue, I am still facing a problem. Here is the relevant code snippet: .App{ background-color: aqua; } .AboutMe{ color:blue; background-color: yellow; } This is from App.js: import logo from '. ...

What is the process for configuring the Sequelize Postgres model type to inet in a database?

I have been utilizing the sequelize ORM to manage my postgress database. Within my postgress database, we have been using the inet data type to store IPv4 and IPv6 values. While creating models in sequelize, I encountered the issue of not finding the ine ...

Uncovering a particular property within an array with the help of EJS

I am still learning about ejs and javascript. I have an ejs file where I want to display a list of array objects with unique properties. My goal is to iterate through the array's length, check if a specific property matches a string, and then display ...

My button is overflowing its container in Bootstrap 5, how can I fix this issue?

I've been experiencing an issue with the button in my code. It keeps extending outside of the parent div container, regardless of the screen size. <header class="header"> <div class="hero text-white pt-7"> <div ...

Achieving a more optimized display on mobile and desktop using Bootstrap 5 techniques

I am working with a bootstrap 5 website template and I need to arrange divs in the following order: Desktop https://i.sstatic.net/qQEiP.png Mobile https://i.sstatic.net/JUnCY.png <div class="d-flex justify-content-between align-items-center pt- ...

Ways to extract information using Ajax

I am working with a variable named sid that represents the number of seats. My goal is to pass sid to the test method in the TryJSON.aspx file, manipulate the data within the method, and then return the result to the ajax call. However, I encountered an er ...

Creating a clickable map for a PNG image: Step-by-step tutorial

My goal is to create a interactive map similar to this one. Click here for the image ...

An error has occurred with bootstrap.js due to an issue

I encountered an issue on my website. The error message reads: Timestamp: 10/17/2012 8:27:23 PM Error: TypeError: $ is not a function Source File: path to my site/js/bootstrap.js Line: 23 If this error is caused by a conflict with another j ...

Changing the style.backgroundImage property overrides any image transition effects

I am currently working on creating a button for a player. You can check out the video (here) The button works, but in order to give it a "pressed" effect, I have to change its background-image on click. However, this action seems to override the transitio ...

Scrolling the y-axis with a fixed height limit to prevent overflow

My current dilemma is a seemingly simple one: <div class="container"> <div class="a"></div> <div class="b"></div> <div class="c"></div> </div>​ Within the container, there are 3 divs: A and B ...

Additional headers are included in the Access-Control-Request-Headers

I have been struggling to include a customized header in my angular js GET request like so: $http({ method : 'GET', url : s, headers : { "partnerId" : 221, "partnerKey" : "heeHBcntCKZwVsQo" } ...

Issues with the menu hiding on mobile devices while using Bootstrap

Hello everyone, I'm currently working on creating a left-sided menu using bootstrap. I have implemented jQuery to toggle the menu show/hide functionality for a button click. It works perfectly in Desktop view, but in the Mobile view, the button is not ...

Unable to abort AWS Amplify's REST (POST) request in a React application

Here is a code snippet that creates a POST request using the aws amplify api. I've stored the API.post promise in a variable called promiseToCancel, and when the cancel button is clicked, the cancelRequest() function is called. The promiseToCancel va ...

Associative TypeScript Arrays

I'm attempting to organize reservations based on business ID in order to achieve a specific end result. Here is the desired output: [ [businessID1] => [Object1,Object2, Object3], [businessID2] => [Object1,Object2], [businessID3] => [Obje ...

Is it possible to create an API directly within the URL of a React.js application, similar to how Next.js allows?

When using Next.js, I can access my application on localhost:3000, and also access my API from localhost:3000/api/hello. I'm curious if there is a way to achieve this same setup with React.js and another framework like Express.js? If Next.js is not ...

Displaying a nested list of lists using AngularFire2 can be achieved by following these steps

I'm currently working on a task to showcase a list of 'stations' and underneath each 'station' returned, I want to display a list of 'projects' that are currently at that particular 'station'. By utilizing angul ...

Having trouble with the Python for loop functioning incorrectly?

I'm facing issues with my for loop in my Django application. I'm attempting to display other users who have logged in under "Users who could be friends," but nothing is appearing. I believe my app will function correctly once I resolve this issue ...

How come node.js is displaying an unusual date format when my database records show the date as 2017/11/4?

For generating the current date in the format YY/MM/DD, the following code is being used. The variable "dateTime" correctly stores dates like 2017/11/4 in the database. However, when trying to display it on the webpage, the date appears as Sat Nov 04 2017 ...