Jump to main content Jump to doc navigation

modX.regClientStartupScript

Other versions: 3.x — Found a problem? Please edit this page or report an issue.

modX::regClientStartupScript

Register JavaScript to be injected inside the HEAD tag of a resource.

Syntax

API Doc: http://api.modx.com/revolution/2.2/db_core_model_modx_modx.class.html#%5CmodX::regClientStartupScript()

void regClientStartupScript (string $src, [boolean $plaintext = false])

Example

Register some JS to the start of the page:

$modx->regClientStartupScript('assets/js/onload.js');
$modx->regClientStartupScript('//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"');
$modx->regClientStartupScript('http://code.jquery.com/jquery-latest.min.js');

See Also