隐藏的输入字段在页面中是否有物理位置?
我知道这个问题可能听起来很愚蠢(我肯定觉得它有点问),但最近我创建了一个包含很多隐藏字段的网站(用JavaScript DOM创建),我注意到底部有一个巨大的空白区域.这页纸.
我检查了代码,但找不到任何可能导致此问题的内容.
var hiddenfield = document.createElement('input');
hiddenfield.setAttribute("type","hidden");
hiddenfield.name = "hiddenfield";
hiddenfield.id = "hiddenfield";
hiddenfield.setAttribute("value", document.getElementById("select1 4").value);
formNew.appendChild(hiddenfield);
Run Code Online (Sandbox Code Playgroud)
我在一些代码中编辑,以显示我创建隐藏字段的方式.
不,input type="hidden"字段不会造成这种情况.可能还有一些CSS样式或width和height设置.
他们这样做有一个位置,试图改变hidden在text从开发者控制台,你会看到它的位置.他们刚崩溃了.不以任何方式影响布局.