Reputation: 31
How can I pass the value entered by user in the search bar with the link in the button.
<form>
<input type="text" id="search" class="st-search-input search-field" value="abc"/>
<button type="submit" onclick='window.open("test4?abcd=\"search.value\"");'>Submit</button>
</form>
Upvotes: 0
Views: 3185
Reputation: 445
<form>
<input type="text" id="search" class="st-search-input search-field" value="abc"/>
<button type="button" onclick='javascript: window.open("test4?abcd="+ document.getElementById("search").value);'>Submit</button>
</form>
OR
<form action="test4" target="_blank">
<input type="text" name="abcd" value="abc">
<button type="submit">Submit</submit>
</form>
Upvotes: 1