views:

842

answers:

2

Hi All

I'm using TinyMCE on the text-areas in my Magento admin section. I have my TinyMCE editor visible form the start, but I want the option to disable/re-enable it.

I'm using the jQuery plugin version, so I added some script, which is almost working. However, it's only affecting the first instance of TinyMCE - if there are any other instances of it on the page, they are not affected.

Any ideas why? Here's my code:

var $j = jQuery.noConflict();
// Add ON OFF toggle switch
$j(function() {
$j('textarea').after("<br/><span class=\"toggle form-button\">Toggle TinyMCE</span>"); 
$j("span.toggle").toggle(function(){
$j('.wrapper').find('textarea').tinymce().hide();
        }, function () {
$j('.wrapper').find('textarea').tinymce().show();
    });
});
+1  A: 

Does this example help?

http://tinymce.moxiecode.com/examples/example_01.php

PHP-Steven
I actually used this example - http://tinymce.moxiecode.com/examples/example_23.php - as a base for what I've done so far. But still can't figure out why it's affecting the first instance only.
Sam
Hmmmm...works ok if I repeat the script for each separate text area, like textarea:eq(0), textarea:eq(1) etc. Guess that'll have to do for now until I can figure this out...
Sam
A: 

Works ok if I repeat the script for each separate text area, like textarea:eq(0), textarea:eq(1) etc. Don't know why, but it'll do.

Sam