tags:

views:

26

answers:

1

I have a form <form> <input id="input" type="number"> <input type="submit"> </form> I want to be able to input a number into the number and click the submit button and javascript displays a number based on the number submitted.

(My Guess is that this question is very basic but I am pretty knew to javascript.)

+2  A: 

Here is a very simple (jquery-less) example of what you might be after:

    <script type="text/javascript">
        function ShowANumber() {
            var currentNumber = document.getElementById("input").value;
            var newNumber = currentNumber * 10 // Do something with input
            document.getElementById("result").innerHTML = newNumber;    
            return false;  // Stop form submit
        }
    </script>
    <form onsubmit="return ShowANumber();">
        <input id="input" type="text"/>
        <input type="submit"/> 
    </form>
    <div>Result: <span id="result"></span></div>
eddiegroves
Thanks, that is exactly what I was looking for.
chromedude