string t3lib_div::wrapJS($jsCode)
$jsCode = "alert('Hello, World!')"; echo t3lib_div::wrapJS($jsCode);
$jsCode = " var element = document.getElementById('myDiv'); element.style.backgroundColor = 'red'; "; echo t3lib_div::wrapJS($jsCode);
These examples demonstrate how to use the t3lib_div wrapJS function in PHP to insert Javascript code on a web page. It is essential to add this function to the TYPO3 CMS package library to use it.