'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);
Solution 1:[1]
Something like:
var archon = document.getElementById('buscaRaca').value;
var position = document.getElementById(archon).getBoundingClientRect();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Ivan P. Arabadjiev |