Input Checkbox checked Property - Use a checkbox to convert text in an input field to uppercase: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Checkbox

Description

Input Checkbox checked Property - Use a checkbox to convert text in an input field to uppercase:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form>
First Name: <input type="text" id="fname" value="Donald">
<br><br>
Convert to upper case/*ww w .j a  va 2 s . c  om*/
<input type="checkbox" onclick="if(this.checked){myFunction()}">
</form>

<script>
function myFunction() {
    document.getElementById("fname").value = document.getElementById("fname").value.toUpperCase();
}
</script>

</body>
</html>

Related Tutorials