Title: [plugins] textarea and javascript
Last modified: August 20, 2016

---

# [plugins] textarea and javascript

 *  [xundeenergie](https://wordpress.org/support/users/xundeenergie/)
 * (@xundeenergie)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/plugins-textarea-and-javascript/)
 * Hi!
 * I’m new on wordpress… and I coded a new plugin. But I have a big problem.
    I 
   use Fancybox to show some youtube-videos with this plugin. And to set some settings
   for fancybox i have to write a script in <script>-tags. This works fine.
 * But, when I want to make this settings customizable, I can’t.
 * I will do this in an <textarea>
 * The default-settings are set at activation of the plugin in a function with this
   code:
 *     ```
       function jquery_defaults() {
       $fb_settings_def = esc_attr("        'padding'       : 6,
       //        'autoScale'     : false,
               'transitionIn'  : 'elastic',
               'transitionOut' : 'elastic',
               'speedIn': 500,
               'speedOut': 500,
               'title'         : this.title,
               'titlePosition'   : 'inside',
               'easingIn'   : 'easeOutBack',
               'easingOut'   : 'easeInOutElastic',
               'href'          : this.href.replace(new RegExp(\"watch\\\?v=\", \"i\"), 'v/')+ '&autoplay=1',
               'type'          : 'swf',
               'swf'           : {
                    'wmode'        : 'transparent',
                   'allowfullscreen'   : 'true'
               }");
         add_option('fb_settings_def', $fb_settings_def);
       ```
   
 * I need the “esc_attr” for displaying this code correctly in my textarea:
 *     ```
       <textarea wrap="physical" cols="120" rows="30" name="fb_settings" id="fb_settings" aria-describedby="newcontent-description">
       <?php echo get_option('fb_settings_def'); ?>
       </textarea>
       ```
   
 * And i try to write this settings into the page in <script>-tags with:
 *     ```
       <script type="text/javascript">
       jQuery(function(){
       //jQuery-fancybox
       jQuery("#youtube_fancybox_<?php echo $ytid . "-" . $rz; ?>").click(function() {
       jQuery.fancybox({
       <?php echo esc_attr_e(get_option('fb_settings_def')); ?>
       	'width'		: '<?php echo $video_x; ?>',
       	'height'	: '<?php echo $video_y; ?>',
   
           });
   
       return false;
   
       });
       })
       </script>
       ```
   
 * But the result is:
 *     ```
       jQuery(function(){
       //jQuery-fancybox
       jQuery("#youtube_fancybox_Lr184Ms5hlE-813").click(function() {
       jQuery.fancybox({
       &#039;padding&#039;       : 6,
       //        &#039;autoScale&&#039;     : false,
               &#039;transitionIn&#039;  : &#039;elastic&#039;,
               &#039;transitionOut&#039; : &#039;elastic&#039;,
               &#039;speedIn&#039;: 500,
               &#039;speedOut&#039;: 500,
               &#039;title&#039;         : this.title,
               &#039;titlePosition&#039;   : 'inside',
               &#039;easingIn&#039;   : &#039;easeOutBack&#039;,
               &#039;easingOut&#039;   : &#039;easeInOutElastic&#039;,
               &#039;href&#039;          : this.href.replace(new RegExp(&quot;watch\\?v=&quot;, &quot;i&quot;), 'v/')+ &#039;&autoplay=1',
               &#039;type'          : 'swf',
               &#039;swf'           : {
                    &#039;wmode&#039;        : 'transparent',
                   'allowfullscreen'   : 'true'
               }	'width'		: '800',
       	'height'	: '600',
   
           });
   
       return false;
   
       });
   
       })
       ```
   
 * How can i do this right?

The topic ‘[plugins] textarea and javascript’ is closed to new replies.

## Tags

 * [esc_textarea](https://wordpress.org/support/topic-tag/esc_textarea/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [textarea](https://wordpress.org/support/topic-tag/textarea/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [xundeenergie](https://wordpress.org/support/users/xundeenergie/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/plugins-textarea-and-javascript/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
