-1

如何让它与纯 js 一起使用?(Como faria isto com js puro?)

<form id="formBuscaAncoraHash" class="search-form">
    <div class="form-group">
        <span class="icon fa fa-search"></span>
        <input id="buscaRaca" class="form-control form-control-lg" type="submit" value="Digite um nome" />
    </div>
</form>
var anchor = $("#buscaRaca").val();
var position = $("#"+anchor).offset();
window.scrollTo(position.left, position.top);
4

1 回答 1

0

就像是:

var archon = document.getElementById('buscaRaca').value;
var position = document.getElementById(archon).getBoundingClientRect();
于 2020-05-20T11:07:09.090 回答