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

  • Home
  • SEARCH
  • 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 7938447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:48:56+00:00 2026-06-03T22:48:56+00:00

I am developing a webpage but I came into some trouble with some javascript

  • 0

I am developing a webpage but I came into some trouble with some javascript code.

I am using the Nicedit as WYSIWYG for textareas, which, as stated in its main page, is as easy as copy/paste this 2 lines anywhere in my web page:

<script src="http://js.nicedit.com/nicEdit-latest.js" type="text/javascript"></script>
<script type="text/javascript">bkLib.onDomLoaded(nicEditors.allTextAreas);</script>         

That’s working great with the default textareas of the page. The problem is that I also have this javascript to add more textareas:

function addchapter()
  {
  if (num_chapter < 10)
    {
    var num=num_chapter+1;
    document.getElementById('chapters').innerHTML += "<h3>Chapter " + num + "</h3> Title: <input type='text' name='titlechapter_" + num + "'><br>Content:<textarea  name='chapter_" + num + "'></textarea>";
    }
  else if (num_chapter == 10)
    {
    document.getElementById('chapters').innerHTML += "<br />Maximum is 10 chapters.";
    }
  num_chapter += 1;
  }

So when I add a textarea through javascript, it doesn’t have the proper style; it’s not implementing Nicedit. The thing is that the textareas are all standard, so there’s no difference between the code in both cases. I don’t know too much of javascript but I think that the problem might be that the Nicedit code runs ONCE when the page loads, and that’s it. Any idea of how to make it run when the page loads (<= already done) AND when the addchapter function is run?

The relevant HTML bit is this:

 <div id="chapters">
 </div>
 <button type="button" onclick="addchapter()"> Add chapter </button>

My page where you can see the odd behaviour is this (broken link), under Chapter 1 you see the ‘Add chapter’ button.

Thank you all so much.

EDIT 1, Error console output:
When the page loads it throws this:

"GET http://js.nicedit.com/nicEditIcons-latest.gif 
bkClass.extend.getStylenicEdit-latest.js:8
bkClass.extend.constructnicEdit-latest.js:38
AnicEdit-latest.js:8
bkClass.extend.addInstancenicEdit-latest.js:37
bkClass.extend.panelInstancenicEdit-latest.js:37
nicEditors.allTextAreasnicEdit-latest.js:37
bkLib.domLoaded"

When I add a new chapter:

"Uncaught TypeError: Object #<bkClass> has no method 'removeInstance'
bkClass.extend.checkReplacenicEdit-latest.js:37
bkClass.extend.panelInstancenicEdit-latest.js:37
nicEditors.allTextAreasnicEdit-latest.js:37
(anonymous function)/file/new/:112
onclick"
  • 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-03T22:48:57+00:00Added an answer on June 3, 2026 at 10:48 pm

    You have to assign a unique ID to the text fields you add to the page. To convert it into an editor you can then call;

    nicEditors.findEditor(editorID);
    

    Or you can call nicEditors.allTextAreas() again. But I’m not sure if that will remove the existing content from the editors that already exist.

    Source: The API.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a webpage where user is searching for files using tags. I
I am developing contactus webpage which have a input field called Email. It is
I am developing an Android app which needs to poll a specific webpage in
I am developing a webpage for offline CRUD for a sqlite database using sqlite.
to all. i developing a webpage using asp.net with c# language, in this webpage
I am developing some websites on my Mac (Standard LAMP setup, with PHP5, Using
I just started developing a multilingual webpage which site users can read and post
I am developing an android project.i want to access some portion of a webpage
I have a collection of extjs objects on a webpage, developing using Firefox so
HI, I am developing a web page using asp.net. I am using some links

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.