Concatenate user and hidden input in form to append URL
Concatenate user and hidden input in form to append URL
I’m using onsubmit to concatenate an input search value with a hidden set value in a form using get method as a workaround to hide certain products from search in shopify .
<form action="/search" method="get" role="search" onsubmit="q.value = search.value +' '+ myset.value";>
{% include 'icon-search' %}
{{ 'general.search.submit' | t }}
</div>
It works but results in a messy URL because I end up with a URL that has all the input data plus the concatenated output.
Basically all I need to do is append my set value to the end of the search query eg.
http://www.example.com/search?q=usersearchvalue+mysetvalue
But is there a neater way to achieve this result?
TIA
Apologies! Added ☝🏻
– mwalker
2 days ago
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
your code where is it ?
– Muhammad Omer Aslam
2 days ago