Change form action on select option

前端 未结 4 800
死守一世寂寞
死守一世寂寞 2020-12-03 18:13

I want to change the form action based on a selection value.

Hi Guys,

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-03 19:04

    Add this to your select:

    onchange="changeAction(this)"

    and this to your javascript

    changeAction = function(select){
       document.getElementById("store").action = select.value;
    }
    

提交回复
热议问题