thymeleaf 传参到js的onclick事件中


html:

<
img th:onclick="'javascript:imgClick(\''+${card.id}+'\',\''+${card.name}+'\');'" />

js:

function imgClick(greetCardId, name) {
        $("#greetCardId").val(greetCardId);//Id
        $("#bigImg").attr("src", name);//名称图片
        //alert("id:" + $("#greetCardId").val() + "---img:" + $("#bigImg").attr("src"));
        $("#heka-alert-id").show();
    };

 

posted @ 2017-02-27 15:58  艺言弈行  阅读(4636)  评论(0编辑  收藏  举报