How to give focus to a button in HTML

3

How do I give the focus to a button after I have a form with several buttons

For example, I click on Coca Cola 12 Onz. That is a button but then I would like the green button that says Save (ENTER) every time I select a product to get the focus, how do I do this?

This is the modal

Modal code:

<div class="modal fade" id="modal-venta">

                               ×         Order information              

  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-danger pull-left btn-cerrar-imp" data-dismiss="modal">Cerrar</button>
    <button type="button" class="btn btn-primary btn-flat btn-print"><span class="fa fa-print"></span> Imprimir</button>
  </div>
</div>
<!-- /.modal-content -->

  

    
asked by WilsonicX 17.07.2018 в 18:54
source

1 answer

1

Change HTML

  </div>
  <div class="modal-footer">
    <button type="button" class="btn btn-danger pull-left btn-cerrar-imp" data-dismiss="modal">Cerrar</button>
    <button id="btnImprimir_modal_ventana" type="button" class="btn btn-primary btn-flat btn-print"><span class="fa fa-print"></span> Imprimir</button>
  </div>
</div>

With this when you click on a button, focus on the second

$('#MainButton').on('click',function(){
 $('#modal-venta').modal('show');
 $('#btnImprimir_modal_ventana').focus();
});
    
answered by 17.07.2018 / 18:58
source