Jq modified li display Hidden error report?

$("- sharpcity"). On ("change",function () {

)
    var s=$("-sharpheader_right_imgs_ul>li");
    for(var i=0;i<s.length;iPP){
        if(s[i].className!= $(this).val()) {
            console.log(s[i].className);
            s[i].css({"display":"none"});
        }
    }

})

< hr >

clipboard.png

< hr >

the above code li is dynamically rendered to-sharpheader_right_imgs_ul through ajax.-sharpcity is a select drop-down box. Each li has a different class name. I want to hide the li class name when the select is selected, console.log (s [I] .className); output this to successfully obtain each Li, but s[ I] .css ({"display": "none"}); Why can"t you change it? how to write and ask for passing seniors" advice? thank you!


give me a full jQ:


$('-sharpcity').on('change',function(){
    var _class = $(this).val();
    var s=$("-sharpheader_right_imgs_ul>li").hide().filter("."+_class).show();
})
Menu