how change the link form action a accordance with the `

后端 未结 1 1249
盖世英雄少女心
盖世英雄少女心 2021-01-22 17:01

This form is search form. when I click the \"alfamart\" or \"bca\", I want the link change. like this, link: /en2/maps(alfamart)or(bca)/

1条回答
  •  一个人的身影
    2021-01-22 18:00

    You don't need to get value from URL, you can change form action by select box value.

    $('.selectpicker').change(function(){
    if($(this).val() == 'alfamart'){
    	$('form').attr('action','alfamart.html');
      alert('action is alfamart.html');
    } else {
    	$('form').attr('action','BCA.html');
      alert('action is BCA.html');
    }
    });
    
    
    Distination:

    0 讨论(0)
提交回复
热议问题