I have a select that filled with JSON data dynamically with the following data: Element, 1, 2, 3 ... once selected, the select is hidden since a button is shown again, but I can not show it with the Element value, it is shown with the value that the user chose, how could I change the value of the select from Javascript? HTML
<div id="tablaSelect">
<table id=tabla2 style="width:80%" >
<tr>
<th>
<div class="styled-select">
<select class="select" id="boards">
</select>
</div>
</th>
</tr>
</table>
Javascript Select:
$('#boards')
.append($("<option></option>")
.attr("value",'')
.text("Eelement"));
$.each(boards, function(index, value) {
$('#boards')
.append($("<option></option>")
.attr("value",value.id)
.text(value.name));
arrayBoards.push(value.id);
});
Javascript to change
function cambiar(){
document.getElementById("tablaSelect").style.display="block";
document.getElementById("select").value = '';
}