js_escape

Escape single quotes, specialchar double quotes, and fix line endings.

Description

(string) js_escape( (string) $text ); 

The filter js_escape is also applied by esc_js()

Returns (string)

Escaped text.

Parameters (1)

0. $text (string)
The text to be escaped.

Usage

  1. if ( !function_exists( 'js_escape' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/backpress/functions.formatting.php'; 
  3.  
  4. // The text to be escaped. 
  5. $text = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = js_escape($text); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-includes/backpress/functions.formatting.php  
  1. function js_escape( $text ) { 
  2. return esc_js( $text );