-2

I need to append numeric value stored in one variable to form input fields.

Let's Say

var b= 5;
var text=$("#dropdown_id").val();

I want to append value of variable b in dropdown_id .

My expected result is #dropdown_id5

stackoverflowuser
  • 252
  • 1
  • 3
  • 12

1 Answers1

1

Use string concatenation:

$("#dropdown_id" + b).val()
PeterKA
  • 22,910
  • 4
  • 23
  • 48