I'm trying to append/prepend option tags to a appended select input in a form. Simply my form is appended to the body like this:
c.append( $('<form>').attr({
'method': 'POST',
'action': ''
}).append( $('<select />').attr({
'name': 'retour'
}) ));
Now I want to append Option tags to this form without having to create a .append( $('<option>').attr() )
etc like 5 times.
I found questions like:
- jQuery append inside appended element
- What is the best way to add options to a select from an array with jQuery?
- Programmatically create select list
But none of them are working in my case. Hopefully someone knows a answer, thank instead.