First time here? Check out the FAQ!
1

How to display two wmd editors on same page
 

Hello,

I want have 2 forms on the same page. I edit a log wmd.js to show the toolbar on 2 forms, but when I press a button of the toolbar on the second form, the actions are fired on the first form text area.

How I can fix this?

Best Regards

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
darkness51's avatar
31
darkness51
asked 12 years ago
Evgeny's avatar
13.2k
Evgeny
updated 12 years ago

Comments

I'm going to edit the title a bit.

Evgeny's avatar Evgeny (12 years ago)
see more comments

1 Answer

0

Askbot's version of wmd editor (note that it is not the same as the "official" version) will not work in more than one copy on a single page, because it uses hardcoded element IDs to assign behavior to DOM elements. Look for any getElementById() calls in the wmd.js.

According to HTML standard it is illegal to have > 1 element on a page with the same ID.

So that needs to be fixed first - probably by allowing to sett unique id's to the parts of different wmd instances. The "id bug" can be fixed by switching to classes, but it would still be necessary to assign unique behavior to the instances, esp. in the cases when contents is to be saved on the server.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 12 years ago, updated 12 years ago
link

Comments

see more comments