Issue with .change function in jQuery form

前端 未结 4 558
囚心锁ツ
囚心锁ツ 2021-01-24 15:57

I am working on a script that changes the span text value depending on user input in the select menu.

I have a fault with my current script. How do I fix it so when I cl

4条回答
  •  清酒与你
    2021-01-24 16:47

    Like this:

    $(function() {         
        $('#usertype').change(function() {        
            let text=$(':selected',this).text();
            $(this).next("span").text(text);
        });     
    }); 
    

提交回复
热议问题