How to Remove Search Button?
RespondidaI'm working on a custom theme so things might be a little tricky. I was able to add a search function to my article page but I don't like how it looks. My goal is to keep the search text section but remove the Search button.
I'm not sure if you need to know any more of the code but this is what I added to my article_page.hbs:
<script>
//dynamic placeholder in searchbar
var gtext = $("span#search_placeholder_text").data('value');
$('#query').attr('placeholder', gtext);
</script>
<section class="sub-nav-wrapper">
<div class="container">
<nav class="sub-nav">
{{breadcrumbs}}
{{search}}
</nav>
Any help is much appreciated
-
Hi Kyle B,
Are you able to share the public URL to your Help Center? This would help a lot.
-
Can I do this without this theme being published?
-
I think preview URLs are publicly available.
Edit: Either way, I think you need to use CSS or JS to simply hide that <input> element.
-
I found the answer. Here is what my code looks like now:
<script>
//dynamic placeholder in searchbar
var gtext = $("span#search_placeholder_text").data('value');
$('#query').attr('placeholder', gtext);
</script>
<section class="sub-nav-wrapper">
<div class="container">
<nav class="sub-nav">
{{breadcrumbs}}
{{search submit=false instant=true class='search'}}
</nav>which makes it look like this:
I also changed it into an instant search so if you type something, you get a list of suggestions without having to hit enter. Much better.
-
Glad you got things working, Kyle! Thanks for coming back and sharing the answer. :)
Por favor, entrar para comentar.
5 Comentários