Jquery / Javascript change form action based on input field

前端 未结 4 925
傲寒
傲寒 2021-01-07 02:51

I have a form like this


    
    
4条回答
  •  孤城傲影
    2021-01-07 03:37

    You need to get the value from the input field and populate the xyz value.. Try this

    $('#myForm').submit(function() {
    
        var value = $('input[type="text"]').val(); 
    
        this.action = 'http://mysite.com/' + value + '.html';
        return true;
    }
    

提交回复
热议问题