I have 2 select boxes. What I need to do is: when the 1st select option I chosen to enable 2nd select options and then when I chose option,it ads it self to a ol li list and disables that option. When I click on li the li should disappear and option on second select box should be enabled.
<div class="styleSelect"> <select class="units" id="select"> <option value="1">Sve ponude</option> <option value="2">1</option> <option value="3">2</option> </select> </div> <div class="styleSelect"> <select class="units" id="change"> <option value="1" disabled="disabled" selected="selected">Sve ponude</option> <option value="2">1</option> <option value="3">2</option> </select> </div> <div> <ol> </ol> </div> jquery:
function getText(){ $('#change').on('change',function(){ $(".value_change").prop('value', 'Potvrdi'); $("#close").css('display', 'none'); conceptName ='<li>' + $('#change').find(":selected").text() + ' ( ' + $('#select').find(":selected").text() + ' ) <a class="speclist-remove"></a></li>'; $('ol').append(conceptName); $('#change').on('change',function(){ if($(this).val()){ $(this).prop("disabled",true); } }); $(".speclist-remove").on("click", function(){ $(this).closest("li").remove(); alert($(this).closest("li").text()); }); }); }