I want to How to add two functions value to a single input. It means I have a dropdown list and an input field. I want to add dropdown list value and input field value to another input field. But according to my code, it overrides value. I can not keep both dropdown list value and an input field value. I want to know how can I keep both dropdown list value and an input field value in the second input field.
function changeFunc() {
$('#currency_name').val($('#cur_rate :selected').text());
}
function click_key() {
$('#currency_name').val($('#cost_price').val());
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<select id="cur_rate" onchange="changeFunc();">
<option>a</option>
<option>b</option>
<option>c</option>
<option>d</option>
</select>
<input type="text" id="cost_price" placeholder="Enter Cost Price" name="cost_price" onkeyup="click_key();">
<input id="currency_name" name="currency_name">
currency_nameinput.