<select>
and <option>
, I need to set selected
to <option>
, but since it is in the loop I can not add directly to this <option>
, have any suggestions or tip?
Follow the code:
var $html = "<select class='form-control' name='usuario' id='usuario'>";
for( var i in data ){
var u = data[i];
$html += '<option value="'+ u.login +'">' + u.login + '</option>';
}
$html += '</select>';