Send form input value to URL

后端 未结 1 673
隐瞒了意图╮
隐瞒了意图╮ 2021-01-17 03:42

I have a simple search form:

相关标签:
1条回答
  • 2021-01-17 04:40

    You may try a javascript redirection for onsubmit event. To avoid empty searches, use the attribute "required" for the input.

    Example:

    <form onsubmit="window.location = 'http://domain.ca/blog/search/' + search.value; return false;">
    <input id="search" placeholder="Search" type="search" name="search"></input>
    <input type="submit" value="Send">
    </form>
    
    0 讨论(0)
提交回复
热议问题