-
-
Save chathurawidanage/e003e494d27ed76c107b7497e88e4a44 to your computer and use it in GitHub Desktop.
DHIS2 tracker capture custom form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p> | |
<input id="ZzYYXq4fJie-GQY2lXrypjO-val" name="entryfield" title="GQY2lXrypjO - MCH Infant Weight (g) - undefined" value="[MCH Infant Weight (g)]" /> | |
</p> | |
<p id="bmi-text"> </p> | |
<script> | |
$(document).ready(function(){ | |
function setColor(color){ | |
$("p#bmi-text").css('background-color',color); | |
} | |
function updateBMI(){ | |
var w=$("#ZzYYXq4fJie-GQY2lXrypjO-val").val(); | |
var bmi=Math.pow(w,2); | |
$("p#bmi-text").text(bmi); | |
if(bmi<10){ | |
setColor('red'); | |
}else if(bmi<20){ | |
setColor('yellow'); | |
}else{ | |
setColor('green'); | |
} | |
} | |
$("#ZzYYXq4fJie-GQY2lXrypjO-val").on('keyup',function(){ | |
updateBMI(); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment