主题
remove_attr
从 HTML 标签中移除指定的属性。
语法
knap
{{ value | remove_attr:"class" }}
{{ value | remove_attr:("class", "style") }}示例
单个属性
json
{
"html": "<div class=\"card\" id=\"intro\">Hello</div>"
}knap
{{ html | remove_attr:"class" }}md
<div id="intro">Hello</div>多个属性
json
{
"html": "<div class=\"card\" id=\"intro\" style=\"color:red\">Hello</div>"
}knap
{{ html | remove_attr:("class", "style") }}md
<div id="intro">Hello</div>