我想使用javascript设置输入值:
document.getElementById("mobileNo").focus();
document.getElementById("mobileNo").select();
document.getElementById("mobileNo").value = "123456789";
不幸的是,当我单击输入字段时,我的值消失了。你能帮我解决这个问题吗?
不点击输入:
<div class="phone-text"><span data-meta="Field" class="next-input next-large"><input id="mobileNo" placeholder="Mobile" name="mobileNo" height="100%" autocomplete="off" value="" data-spm-anchor-id="a2g0o.placeorder.0.74328" aria-label="error"></span></div>
点击输入后:
<div class="phone-text"><span data-meta="Field" class="next-input next-focus next-large"><input id="mobileNo" placeholder="Mobile" name="mobileNo" height="100%" autocomplete="off" value="" data-spm-anchor-id="a2g0o.placeorder.0.74328" aria-label="error"></span></div
正如您在单击输入后看到的那样,添加了“下一个焦点”类,也许这是问题?
我想在速卖通地址表格上使用它: