I'm pass a order id with leading-zero to function, but in the function, the parameter alway convert to number without leading-zero,What should I do?
formatter:function(value, row, index) {
return "<a href='javascript:listGoods("+'09100089'+")'><i class='fa fa-search-plus' /></a>";
}
function listGoods(id) {
jp.openViewDialog("goodInfo", "${ctx}/order/order/goods?id=" + id, "800px", "500px");
}
Your problem is you pass your parameter as a number not as a string. The solution looks like this:
formatter:function(value, row, index) {
return "<a href='javascript:listGoods(`"+'09100089'+"`)'><i class='fa fa-search-plus' /></a>";
}
function listGoods(id) {
jp.openViewDialog("goodInfo", "${ctx}/order/order/goods?id=" + id, "800px", "500px");
}
Here is another example:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script> function addButton() { document.body.innerHTML = "<button onclick='showMeParameter(`" + "09100089" + "`)'>my button</button>"; } function showMeParameter(id) { alert(id); } addButton(); </script> </body> </html>
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.