我收到一个错误,即 where etc.. 行存在语法问题selection = ui.item.addClass
,但我无法弄清楚它是什么。我想我已经逃脱了所有正确的报价,但我不确定。注意:前两个变量意味着包含空单引号。
<?php
echo "<script>";
echo "$(function(){";
echo "var selection = \' \'; ";
echo "var selectClass = \' \'; ";
echo " $(\".menu\").menu({ ";
echo " select: function (event, ui) { "
echo " $(\'.selected\', this).removeClass(\'selected\'); ";
echo " selection = ui.item.addClass(\'selected\').children(\'a\').attr(\'name\');";
echo " }"; // closes select function
echo " }); "; // closes menu
echo " </script>";
?>