Is it possible to generate a url, when you click on the onClick method for a button?

  • Do you need a button to open the site? - Yuri
  • @Yuri yes, exactly - lounah
  • You can do this using jQuery. Write in response, how to use Juqery? - Yuri
  • Yes, I will be grateful - lounah
  • @Schepalin Can you reformulate the question so that it is clearer? - Vadim Ovchinnikov

1 answer 1

$(function() { // код, который выполняется при загрузке страницы $('button').click(function() { alert('Нажали :)'); }); $('button').click(); // собственно само нажатие }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <button>Кликни на меня :)</button> 

  • @Schepalin If this answer helped you, then mark it as accepted. - Vadim Ovchinnikov