I have a Javascript variable which gets the value of the select box. I would like to append input field with value = the value of select box. However, could not get this to work.
$(function () {
$(document).on("change", "#extra_crew", function (e) {
var extra_crew = $('#extra_crew').val();
$('#extra_crew_area').append(
' <div class="col-sm-12 m-t-10 m-b-10 no-padding">'
+ '<%= text_field_tag :reservation_type, "", class: "form-control m-b-10", :value => "'
+ extra_crew
+ '" %>'
+ '</div>');
console.log(extra_crew);
});
});
It works just fine but extra_crew seems a string in the input field could not concatenate.
Then it shows like this.

+extra_crew+