1

I have already append the JQuery value to the select option but I want to append value to an input field, any solutions?

Select option:

<select name="c_email" class="form-control" ></select>

JQuery value append:

$('select[name="c_email"]').append('<option value="'+ value +'">'+ value +'</option>');

Instead of drop down select I want the value here in input field:

<input type="email" class="form-control" name="c_email" placeholder="">
1
  • problem solved! Commented Jul 26, 2020 at 13:02

1 Answer 1

2
$('input[name="c_email"]').val(value);

And you can target that input with any of these, or all to be more precise:

$('input[name="c_email"][type="email"].form-control')

var value="test";
$('input[name="c_email"]').val(value);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="email" class="form-control" name="c_email" placeholder="">

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.