我复制了此模板:
<template id="inputTemplate">
<div class="input-group input-line mb-1">
<input type="text" class="form-control issues-input" size="40" placeholder="Descripcion..." required>
<div class="input-group-append" id="button-addon4">
<button class="btn btn-outline-secondary add-input" type="button"><i class="fa fa-plus"></i></button>
<button class="btn btn-outline-secondary remove-input" type="button"><i class="fa fa-minus"></i></button>
</div>
</div>
</template>
我想向此副本中所有带有此脚本中带有“ .input-line”的元素添加一个类
function addFirstAcHidIssue(){
var template = document.getElementById("inputTemplate")
var issues = document.getElementById("ac-hid-issues")
var copy = template.content.cloneNode(true)
issues.appendChild(copy)
issues.querySelector(".input-line").classList.add("aceite-hidraulico-issues")
}
通过向.input-line添加一个类,它会附加一个孩子但没有运气
我做错了什么?