0

I'm trying to convert some javascript that gives the user a prompt into an html form that displays the output in a span. I've been searching the net but haven't found a way to do it that I can understand.

This is my code: http://jsfiddle.net/nickykw/tMXmj/15/

I'd like the output of the script to be displayed in the "outp" span. If anyone can point me in the right direction I'd be grateful.

Thanks

2
  • 1
    Put the code in there. What is jsfiddle's down? Your question won't mean anything. Commented Jun 5, 2012 at 10:13
  • And reduce that to a minimally-reproducible demo, that shows your problem and doesn't require (hopefully) quite so much JavaScript to negotiate in order to solve. Is the basic problem how to get the guess/user-entered value into a text element in the document somewhere? Commented Jun 5, 2012 at 10:58

1 Answer 1

1

This will help you if you are allowed to use jQuery and you name your controls. If you are not allowed to use jQuery I hope you get the idea.

$(document).ready(function(){
    $('.submit-button').click(function(e){
        e.preventDefault();
        var number = parseInt($('.submit-input').val());
        $('#outp').html(num2Letters(number));       
    });
});

Fiddle: http://jsfiddle.net/Q2P7H/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.