I'm doing a restaurant management system, but I kind of want the select to be dynamic, so the customer does not always want a food, so I wanted to know how I can go about adding it every time I click on it. this system only works on the site, but I just want to use it on localhost and it does not work.
<html><head><body><h1>Peixaria</h1><ulclass="menu cf">
<li><a href="secao.php">Início</a></li>
<li><a href="pedidos.php">Pedidos</a></li>
<li><a href="reserva.php">Reserva</a></li>
<li><a href="relatorio.php">Relatório</a></li>
</ul>
<main>
<form>
<header>
<h2>Fazer Pedido</h2>
</header>
<fieldset>
<label>
<span>Comanda:</span>
<input type="text" value="" autofocus>
</label>
<label>
<span>Mesa:</span>
<input type="text" value="" autofocus>
</label>
<span>Refeições/Bebidas/Sobremesas:</span>
<label>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><selectid="selecionar">
<option selected isabled>Selecione</option>
<option >Costela de Tambaqui sem Espinha</option>
<option selected>Lombo de Tambaqui Frito sem Espinha</option>
<option >Caldeirada de Tambaqui sem Espinha</option>
<option >Caldeirada de Tucunaré</option>
<option selected>Peixe no Tucupi com Camarão</option>
<option >Escabeche de Pirarucu</option>
<option >Escabeche de Tambaqui</option>
<option >Escabeche de Tucunaré</option>
<option >Tucunaré Frito</option>
<option selected>Sardinha Frita</option>
<option >Jaraqui Frito</option>
<option >Pacu Frito</option>
<option selected>Filé de Pirarucu Frito</option>
<option >Filé de Pirarucu a Milanesa</option>
<option >Guisado de Pirarucu</option>
</select>
<a class="add" href="#">+</a>
<hr>
Selecionados
<hr>
<div id="selecionados">
</div>
</label>
<label>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><selectid="selecionar">
<option selected isabled>Selecione</option>
<option >Fanta Laranja 1l</option>
<option >Fanta Laranja 2l</option>
<option selected>Cola Cola 1l</option>
<option >Cola Cola 2l</option>
<option >Bare 2l</option>
<option selected>Fanta Uva</option>
<option >Fanta Laranja</option>
<option >Sprit</option>
<option selected>Cola Cola </option>
<option >Cola Cola zero </option>
<option >Guaraná Antarctica</option>
<option selected>Guaraná Baré</option>
<option >Suco Goiaba</option>
<option selected>Suco Manga</option>
<option >Suco Pessego</option>
<option >Suco Uva</option>
<option selected>Suco Maracujá</option>
<option >Suco Laranja</option>
<option >Suco Caju</option>
<option selected>Agua Mineral </option>
<option >Agua com Gas </option>
<option >Cerveja em Lata</option>
<option selected>Limonada Natural</option>
</select>
<a class="add" href="#">+</a>
<hr>
Selecionados
<hr>
<div id="selecionados">
</div>
</label>
</fieldset>
</form>
</main>
<script>
$(".add").on('click',function(){
var cont=0;
$("#selecionados input").each(function(){
if($(this).val()==$("#selecionar option:selected").html()){
cont++;
}
});
if(cont>0){ alert("Este item ja esta adicionado, altere a quantidade se deseja mais..");}
else{
$("#selecionados").append("<input disabled type='text' name='pedidos[]' value='"+$("#selecionar option:selected").html()+"' ><input type='text' name='quantidade[]' placeholder='quantidade'><br>");
}
});
</script>
</body>
</head>
</html>