I have several inputs with readonly="true" which, when I click the edit button, it should change to readonly="false", but I'm only able to do this if I create 1 script for each input. p>
Would you like to make 1 script to change at all?
I tried to leave everyone with the same ID, but it only changes the first one. The inputs:
<div class="form-group">
<h2>Accomodation</h2>
<div class="form-group">
<label>Name:</label>
<input class="form-control" id="myText" value="Test" readonly="true" />
</div>
<div class="form-group">
<label>Email:</label>
<input class="form-control" id="myText" value="Test" readonly="true"/>
</div>
<div class="form-group">
<label>Email Copy:</label>
<input class="form-control" id="myText" value="Test" readonly="true"/>
</div>
</div>
The script:
<script>
function myFunction() {
document.getElementById("myText").readOnly = false;
}
</script>
I searched the internet but only found out how to change 1 input, several did not find anything.
Thank you in advance!