Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need 2 text areas using CKEDITOR on same page to have diffrent widths?

Posted on 2013-05-21
3
Medium Priority
?
365 Views
Last Modified: 2013-05-21
Hi,
I have 2 text area on my page using CKEDITOR and need different widths for both, but it appears that both get resized to the same value and in this case using the last value specified of CKEDITOR.config.width ='300px';

Is there a way to specify a diffrent size?

Thanks.
<textarea id="content" name="content"><?php echo $content; ?></textarea>
                     
<script>

CKEDITOR.replace( 'content' );
CKEDITOR.config.width ='800px';
CKEDITOR.config.height='500px';
CKEDITOR.config.skin = 'moonocolor';

</script>                     


<textarea id="content2" name="content2"><?php echo $content2; ?></textarea>
                     
<script>

CKEDITOR.replace( 'content2' );
CKEDITOR.config.width ='300px';
CKEDITOR.config.height='500px';
CKEDITOR.config.skin = 'moonocolor';

</script>                     

Open in new window

0
Comment
Question by:sabecs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 39184219
0
 
LVL 7

Accepted Solution

by:
Robert Saylor earned 2000 total points
ID: 39184241
Give this a try. I have a page "php" that uses two CKeditor boxes and both have different sizes.

   <textarea id="editor2" name="editor2" rows="10" cols="80"></textarea>
      <script type="text/javascript">
// This is a check for the CKEditor class. If not defined, the paths must be checked.
if ( typeof CKEDITOR == 'undefined' )
{
   document.write(
      '<strong><span style="color: #ff0000">Error</span>: CKEditor not found</strong>.' +
      'This sample assumes that CKEditor (not included with CKFinder) is installed in' +
      'the "/ckeditor/" path. If you have it installed in a different place, just edit' +
      'this file, changing the wrong paths in the &lt;head&gt; (line 5) and the "BasePath"' +
      'value (line 32).' ) ;
}
else
{
   var editor2 = CKEDITOR.replace( 'editor2',
      {

         width: '275px',
         height: '400px',
         toolbar :
            [
               [ 'Source','Preview' ],
               [ 'Bold', 'Italic','Underline','Strike','RemoveFormat', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', 'Anchor' ],
               [ 'Image','Table','HorizontalRule','SpecialChar','PageBreak'],
               [ 'Styles','Format','Font','FontSize' ],
               [ 'TextColor','BGColor' ],
               [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo','-','Outdent','Indent','Blockquote','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','BidiLtr','BidiRtl' ]
            ]
      });

   editor2.setData( '<?=$sValue2?>' );
   // Just call CKFinder.SetupCKEditor and pass the CKEditor instance as the first argument.
   // The second parameter (optional), is the path for the CKFinder installation (default = "/ckfinder/").
   CKFinder.setupCKEditor( editor2, 'ckfinder/' ) ;
   // It is also possible to pass an object with selected CKFinder properties as a second argument.
   // CKFinder.SetupCKEditor( editor, { BasePath : '../../', RememberLastFolder : false } ) ;
}
      </script>

Open in new window

0
 

Author Closing Comment

by:sabecs
ID: 39184276
Thanks, that did the trick.

CKEDITOR.replace( 'content2',{ width: '275px', height: '400px' });
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question