Modern ShowJumping
Posts: 0
Joined: Sat Aug 09, 2014 7:12 am

Get number from input, button onclick put number in label using event / javastript.

Hi. I've tried to work this out... I have limited code experience (I can read it no worries, but writing from scratch... I didn't learn JavaScript). I am trying to create an input field (number), which when the button is clicked, will result in the number in the label.

I just want to set an event to run Javascript.

Would somebody be so kind as to write this for me?

Its just

user inputs a number

Button.onclick (take number and put it in the label)

I will use that number for calculations... I just need this bit and I'll be right to continue on my own.

Please be kind! :-)

Modern ShowJumping
Posts: 0
Joined: Sat Aug 09, 2014 7:12 am

Get number from input, button onclick put number in label using event / javastript.

This is my code, which doesn't work.

________________________________

Code: Select all

 function calculate() 
 { 

  var param1 = parseFloat(document.getElementById(inputField).value); 

  var tometers = (param1  / 3.28083989501312 * 12);  

  if (!isNaN(tometers)) 
  { 
   document.getElementById("tometers").innerHTML = tometers.toFixed(2) + " meters.  

Between jumps it is " +tometers2.toFixed(1)+ " meters
allowing for landing and take-off.";
}

Code: Select all

  else 
  { 
   document.getElementById("tometers").innerHTML = "bummer"; 
  }
Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Get number from input, button onclick put number in label using event / javastript.

Hi,

To put input value to label you can Run the following code on button Click event:

prevar input = Appery('inputName').val();
Appery('labelName').text(input);/pre

where inputName - name of input component;
labelName - name of label component.

Modern ShowJumping
Posts: 0
Joined: Sat Aug 09, 2014 7:12 am

Get number from input, button onclick put number in label using event / javastript.

Great thanks. I'll check out how to do that with numbers...

Thanks again.

Return to “Issues”