javascript - jQuery change event show on click, swap -


i trying change events swap on dropdown menu. if 1 hidden, want show when value matches, , vise versa. currently, once 1 hidden, , value changes, remains hidden. please help. toggle isnt' working me.

<label for="filter-select"> issue type: </label> <select class="filter" id="filter-select" name="filtering">     <option selected="selected">any</option>     <option value="incident">incidents</option>     <option value="feature">feature requests</option> </select> 
$(".sort > tr > td:nth-child(1)").each(function(){   var textid = $(this).text();   $(this).attr('id', textid);    var id = $(this).attr('id');    $(".sort > tr").each(function(){ var ide = $(this).children('td:nth-child(1)').attr('id'); $(this).attr('id', ide);  });     var username = "dariuscastillo12@qa-team.com" var password = "dpcmixcolt12!!"   var formurl = "/api/v2/requests/"+id+".json)"; function make_base_auth(user, password) {  var tok = user + ':' + password var hash = btoa(tok); return "basic " + hash; }         $.ajax({  type: 'get',  url: formurl,  datatype: "json",  beforesend: function (xhr) { xhr.setrequestheader('authorization',make_base_auth(username, password));  }, success: function (result) {  $.each(result, function(i, value) {     $('.filter').change(function() {     if ($(this).val() =='any') {         $('.sort > tr').each(function() {             $(this).show();         });     }      if ($(this).val() === 'incident') {         $('.sort > tr').each(function() {             if (value.ticket_form_id == '59229' & value.id == $(this).attr('id')) {                 console.log('incident', $(this).attr('id'));                 $(this).toggle();               }         });      }     else if ($(this).val() === 'feature') {         $('.sort > tr').each(function() {             if (value.ticket_form_id == '39365' & value.id == $(this).attr('id')) {                 console.log('new feature', $(this).attr('id'));                 $(this).toggle();             }         });     }          });     })  }  }); });    

enter image description here

i guess toggle wont work select options thinking of. tried hiding option after selected , showing when other option in select selected


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -