My current project consists of a section in which through a javascript (preferably), you have to write a word in an input. Then, you could know if it is the correct word or it is not, then it would be incorrect.
I have been thinking about all the possibilities, and the only thing that I have arrived at the moment is this code that would generate what I am looking for, but at a prompt (something similar to a popup).
function checkAnswer(){
prompt('Cuál es la capital de francia?')
if('paris'){
alert('Correcto')
}
else{
alert('Incorrecto. La respuesta correcta sería París')
}
}
<p>Cuál es la capital de Francia </p>
<button onclick="checkAnswer()">Ir a la pregunta</button>
However, besides that it does not work for me, it's not what I need, since I need it to be generated on the php page itself.
Would you know by chance which function I can use? or if you have a specific name what I'm looking for?
Many thanks and best regards to all