Iam struggeling with the situation that I have to use single quotes and double quotes in Joomla $document->addScriptDeclaration.
$document->addScriptDeclaration('
jQuery(document).ready(function () {
jQuery("a[href="#location").on('shown', function (e) {
initialize();
});
});
');
My problem here is the selector which has to be usually addressed with jQuery("a[href="#location"]). Now here is the situation with double quote in double quote. Changing to single quote is not possible, because the script declaration is within single quotes.
How can I resolve this problem?
The begin of the view is:
// No direct access
defined('_JEXEC') or die;
//JHtml::addIncludePath(JPATH_COMPONENT.'helpers/html');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
JHtml::_('behavior.keepalive');
$document = JFactory::getDocument();
$document->addScriptDeclaration('
jQuery(document).ready(function () {
// remove top banner manual because it is a module loaded by list
jQuery("#top-content-banner").remove();
jQuery("a[href=\'#location\']").on("shown", function (e) {
alert("Hello");
});
});
');