我有以下 HTML:
<input class="vertical-tabs-active-tab" type="hidden" value="account" name="tabs__active_tab">
我需要将“帐户”的值更改为“yolo”的 JavaScript。
我以为我可以这样做:
document.getElementsByClassName('vertical-tabs-active-tab').setAttribute("value", "yolo");
但这会产生以下错误:
document.getElementsByClassName(...).setAttribute is not a function
我无法在输入中添加“id”,我必须根据类更改值。