Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vikramjeet-dev/a9f0eeb11c483647b26692afd11b7e89 to your computer and use it in GitHub Desktop.
Save vikramjeet-dev/a9f0eeb11c483647b26692afd11b7e89 to your computer and use it in GitHub Desktop.
Set another input type value same as entered previously .
//html input type
<input id="current_census" type="text" value="100" onkeyup="findPPD(this.id)">
<br>
<input type="text" id="rn_lvn_census" value="100" onkeyup="findPPD(this.id)">
<br>
<input type="text" id="cna_rna_census" value="100" onkeyup="findPPD(this.id)">
<br>
<input type="text" id="data" value="100" onkeyup="findPPD(this.id)">
<br>
<input type="text" id="census" value="100" onkeyup="findPPD(this.id)">
<br>
<input type="text" id="data1" value="100" onkeyup="findPPD(this.id)">
<br>
<input type="text" id="data2" value="100" onkeyup="findPPD(this.id)">
//this is where the magic happens
<script type="text/javascript">
function findPPD(id){
var idVal = document.getElementById(id).value;
document.getElementById(id).value = (idVal>0)?parseInt(idVal, 10):0;
var cur_census = document.getElementById(id).value;
document.getElementById('rn_lvn_census').value = document.getElementById('cna_rna_census').value = document.getElementById('census').value = document.getElementById('data').value = document.getElementById('data1').value = document.getElementById('data2').value = cur_census;
}
</script>
@vikramjeet-dev
Copy link
Author

hello @tehoawebsite first you have to create a function i have used name findPPD but you can use any function you want and using this keyword you can populate the value where u need .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment