Gur*_* Mb 2 html javascript java jquery thymeleaf
我正在使用"Thymeleaf",我想将值发送到javascript,我是新手,我正在尝试下面的代码:
onclick="getPropId('${properties.id}')"
Run Code Online (Sandbox Code Playgroud)
和功能
getPropId(inputID){alert(inputId);}
Run Code Online (Sandbox Code Playgroud)
但我没有获得实际价值.
上面的问题现在解决了,我们需要使用Thymeleaf特定的语法.
th:onclick="'getPropId(\'' + ${properties.id} + '\');'"
Run Code Online (Sandbox Code Playgroud)
现在如果它在javascript函数中显示正确的properties.id.
function getPropId(inputID){
alert(inputID);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10920 次 |
| 最近记录: |