JSFiddle - React, Tailwind, and code Playground
HTML
<div id="bar">
<table id="foo">
</table>
</div>
<input type='text' value="" id="numtop" />
<input type='button' value="go" id="go" />
CSS
#bar {
height: 200px;
overflow: auto;
}
JavaScript
$(function() {
for (i = 0; i < 100; i++) {
$('#foo').append('<tr><td>num_' + i + ' : </td><td><a ><input name="fff" id="t' + i + '" type="submit" value="+"></a></td></tr>');
}
$('#bar').on('click', '[name="fff"]', position);
$('#go').on('click', function() {
cible = $('#numtop').val();
if (isNaN(cible)) {
return false;
}
$('#bar').scrollTop(cible*29)
})
function position() {
alert($('#bar').scrollTop);
}
})