Change value of materialize select box by jquery

前端 未结 11 1522
滥情空心
滥情空心 2020-12-29 22:18

I want to change materialize select box value by jquery.

I am using $(\'#myselect\').val(\'1\'); on onchange event of other select box but

11条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-29 22:47

    Solution, I used in my project:

    document.getElementById("mySelect").addEventListener("change", function()
    {
      console.log("Hello, World!")
    });
    

    I don't know if the event trigger gives you selected item or selected item's value - you can check it yourself!

提交回复
热议问题