0

I have an input field and I am putting value in it dynamically so I am getting 01 value to put in the text box

$('#final_result').val(open+close); 

I have an input field which id is final_result and I am getting 0 in open and 1 in close as a number. I try to convert it into string like

$('#final_result').val(toString(open)+toString(close)); 

but still getting 1 in input I want 01 in input field.

6
  • You want to print "01" if you enter 1 in the input? Commented Oct 25, 2020 at 2:48
  • whatever i am getting in open and close i want to combine that and print it in input but if i get 0 in open then i am getting only the close value Commented Oct 25, 2020 at 2:50
  • Try using : $('#final_result').val('+open+''+close+'); Commented Oct 25, 2020 at 2:51
  • still same result Commented Oct 25, 2020 at 2:56
  • 1
    Should be open.toString() + close.toString() Commented Oct 25, 2020 at 3:04

1 Answer 1

1

Try this:

$('#final_result').val(open+""+close); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.