最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - passing JSTL to javascript - Stack Overflow

programmeradmin5浏览0评论

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
Add a ment  | 

2 Answers 2

Reset to default 5

If 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}'/>);"
发布评论

评论列表(0)

  1. 暂无评论