get sqrt

HTML
<!DOCTYPE HTML> <div class="col-xs-2"> <h1>Find Square Root</h1> <div class="input-group"> <input type="number" id="number" name="number" class="form-control" placeholder="Number"> <span class="input-group-btn"> <button class="btn btn-default" type="button" onClick="getSqRt()">Submit</button> </span> </div> <!-- /input-group --> </div> <!-- /.col-xs-2 --> <p id="result"></p>
CSS
body { padding: 15px; } #result { font-size: 50px; padding-top: 50px; }
JAVASCRIPT
function getSqRt() { var input = document.getElementById("number").value; document.getElementById("result").innerHTML = "Result: " + Math.sqrt(input); }
Expand for more options Login