admin管理员组文章数量:1335555
I want to pass JSTL from my onclick event to javascript. My onclick looks like this,
onclick="cancelButtonAction(<c:out value='${loop.index}'/>, <c:out value="${iList.inStr}"/>);"
and my cancelButtonAction function is,
function cancelButtonAction(index, inSchLdTsStr){
document.getElementById('loadDate'+index).value = inSchLdTsStr;
}
But this wouldnt work. Onclick the event is not getting triggered. Any suggestions?
I want to pass JSTL from my onclick event to javascript. My onclick looks like this,
onclick="cancelButtonAction(<c:out value='${loop.index}'/>, <c:out value="${iList.inStr}"/>);"
and my cancelButtonAction function is,
function cancelButtonAction(index, inSchLdTsStr){
document.getElementById('loadDate'+index).value = inSchLdTsStr;
}
But this wouldnt work. Onclick the event is not getting triggered. Any suggestions?
Share Improve this question asked Jun 7, 2013 at 20:28 GeekGeek 3,32916 gold badges79 silver badges122 bronze badges 1- Do you see any JS error in console ? – NullPointerException Commented Jun 7, 2013 at 20:36
2 Answers
Reset to default 5If it is a string you need to add the '
or "
for the parameter, look the code below:
onclick="cancelButtonAction(<c:out value='${loop.index}'/>, '<c:out value="${iList.inStr}"/>);'"
Your string is terminated in between
use like this.
onclick="cancelButtonAction(<c:out value='${loop.index}'/>, <c:out value='${iList.inStr}'/>);"
本文标签: javapassing JSTL to javascriptStack Overflow
版权声明:本文标题:java - passing JSTL to javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742249219a2440431.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论