jquery怎么操作thymeleaf元素?
问题描述:
向各位大佬请教:
元素如下所示:
想要通过jquery方式更改模板第二行
jquery的写法如下所示:
$("#blank_showz").empty();
var $new_obj = $("<div></div>");
$("#blank_showz").append($new_obj);
$("#blank_showz div").attr("th:replace","./odata-template.html :: test-my");
最后通过alert($("#blank_showz").html())查看的时候,出现的是
<divth:replace=“./odata-template.html :: test-my"></div>,而不是显示另外一个 ./odata-template.html页面中的模板test-my的内容。
各位大佬,请问这是什么原因造成的?难道是我这种方式不可取吗?如果我这种的方式不可取,那么应该通过别的什么方法?望各位大佬不吝赐教!先在此谢过了!
答
th:replace这种thymeleaf模板属性是在服务器端处理的。你前端设置th:replace这种属性是没用的
答
th:replace这种thymeleaf模板属性是在服务器端处理的。你前端设置th:replace这种属性是没用的
答
用ajax加载其他模板页面内容,更新容器,无法用js修改服务器端标签调用