Add option in select input box using jQuery
Adding option using jQuery: in your web page you can add a new option or single option in a select input box using jQuery. It is very simple to insert a new option, follow the example and source code, which will help you to done this in your webpage.
Developers are using jQuery in their web pages for many purposes. In this tutorial I will help you how to append a option with option value in a select input box of a web page using append() function. When you click a button or return some value then you want to add a single option in <select> tag using the example code of this tutorial.
Example:
$('#select_id').append('<option value="five" selected="selected">Five</option>');
Or Try it:
$('#select_id').append($('<option>', { value: 1, text: 'One' }));
Related posts