vendredi 29 janvier 2021

Can I get the ID of an HTML element in a javascript function without passing any parameters?

Can I get the ID of an HTML element in a javascript function without passing any parameters?

I have an HTML element:

<input type="text" id="exampleInput" value="0" onkeypress="exampleFunction()">

From javascript, I would like to change the value of the HTML element.

function exampleFunction{
  
}

Is it possible to achieve this without passing the ID as a parameter?




Aucun commentaire:

Enregistrer un commentaire