<input name="" type="button" value="to 3" class="but" data-i="2">
$('.but').on('click', function() { var i = this.dataset.i; var cls = `#accordion li:eq(${i})`; $(cls).trigger('click') })