简体   繁体   中英

Function JQUERY with anchor in pure javascript

How would get this to work with pure js?

<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);

Something like:

var archon = document.getElementById('buscaRaca').value;
var position = document.getElementById(archon).getBoundingClientRect();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM