Answer the question
In order to leave comments, you need to log in
How to go to another page on button click?
I have the following html code:
<div class="buttons">
<p><input type="text" name="userName" placeholder="Name:" size="18" /></p>
<p><input type="text" name="userName" placeholder="Name of the room:" size="18" /></p>
<a href="#" class="modal__trigger2">Join Room</a>
</div>
Answer the question
In order to leave comments, you need to log in
1) add id for input.
2) make a call to this function on pressing a or button (example code):
function openURL()
{
let user = document.getElementById('userName').value;
let room = document.getElementById('roomName').value;
var url = '/?user=' + encodeURIComponent(user) + '&room=' + encodeURIComponent(room) ;
window.location.href = url;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question