javascript – Can more than one id be placed in a single input type text?


My question is if more than one id can be placed in an input because I have a function in javacript that I command to call it in the id of an input type text but in that input I also have to have the id with the variable of my database data. where the data will be inserted.

this is the input code:

  <h5>Avance 1:</h5>
  <input type="text" name="CONTRATO" id="total" size="5" value="<%= rs.getString(5) %>" disabled="0">

the name of my Javascript function is total and my database variable is called contrato

How could I do it in that case?


I leave you an example with a div that has 2 id, the first call with the first id works, instead when the second div is called there is an error! }

conclusion: there cannot be 2 id in an element.

var texto=document.getElementById("uno").innerHTML;

var texto=document.getElementById("primero").innerHTML;
<div id="uno" id="primero"> 1</div>
Scroll to Top