The show password function only works on the first row of the entry and is not working on the next entries/rows. The items are displayed by php through the database using foreach. how will the show/hide password work for all entries? any ideas?? I have the code as follows:
Html:
<td data-title="Password"><input id="viewPass" type="password" value="<?php echo $item["password"]; ?>" readonly/></td>
<button type="button" id="viewPswd" class="btn btn-default"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></button>
<script src="js/showPass.js"></script>
Javascript:
var myButton = document.getElementById('viewPswd'),
myInput = document.getElementById('viewPass');
myButton.onclick = function () {
'use strict';
if (this.id === 'viewPswd') {
myInput.setAttribute('type', 'text');
this.textContent = 'Hide';
} else {
myInput.setAttribute('type', 'password');
this.id = 'viewPswd';
}
};