简体   繁体   中英

How to solve unterminated string constant javascript error

I am trying to pass multiple parameters in onclick function but i am getting unterminated string constant

<s:iterator value="#childMenu.menuItems" id="childs">
        <s:set var="childItemName" value="#childs.menuItemName" />
        <s:set var="childItemURL" value="#childs.menuItemUrl" />
        <sj:menuItem id="secondLevelChildMenuItem" title="%{childItemName}" onclick="javascript:showLink('%{childItemName}','%{childItemURL}');"></sj:menuItem>
        </s:iterator>

what's wrong in my code?

As pointed out by Dave in the comment, you likely have an unescaped single or double quote in your childItemName or childItemURL values. Take a look here for more info .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM