Saved X
Google login
SignUp with Email
X

Less than equal to in javascript

theindreshverma ( Edited  Sep 01, 11:17 pm )
Login

Less than equal to

<p id="show"></p>
<input type="number" id="d1" placeholder="Enter digit 1" /><br><br>
<input type="number" id="d2" placeholder="Enter digit 2" /><br><br>
<button onclick="check()">Check</button>

<script>
function check() {
    var d1 = document.getElementById('d1').value;
    var d2 = document.getElementById('d2').value;
    if(d1 <= d2) {
        document.getElementById('show').innerHTML = 'd2 is greator than or equal to d1 ';
    }
    else {
        document.getElementById('show').innerHTML = 'd2 is less than d1 ';
    }
}
</script>

Sourcecode Tags

More Sourcecodes

More Sourcecodes