admin管理员组文章数量:1428559
I'm having troubles replacing text when there is something entered in the search form.
As you can see in the image below i want to replace 'mijn gemeente' with the get_search_query
text if i'm searching something, if nothing is searched it should show 'mijn gemeente'.
I'm having troubles replacing text when there is something entered in the search form.
As you can see in the image below i want to replace 'mijn gemeente' with the get_search_query
text if i'm searching something, if nothing is searched it should show 'mijn gemeente'.
- where is your search input? show the code, sharing snapshot of the code makes us to help more difficult – Vishwa Commented May 7, 2019 at 9:49
- Search input is in my sidebar. I can get the text from the input and show it but i want it only to show if there was anything searched. When there is nothing searched it should show 'mijn gemeente'. So basically i need some sort of IF loop i think. – Dennis Commented May 7, 2019 at 10:04
- I found it out, thanks for the help though. :) – Dennis Commented May 7, 2019 at 10:15
1 Answer
Reset to default 0You can do that using jQuery's focus
function. add following into your php file inside <script>
tags.
$("#your-searchinput-id").focus(function() {
$("h4.title_sidebarsub").text("<?php echo $string ?>")
});
$(this).blur(function() {
$("h4.title_sidebarsub").text("mijn gemeente")
});
本文标签: wp queryHelp with showing text when something is entered in my search bar
版权声明:本文标题:wp query - Help with showing text when something is entered in my search bar 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745517264a2661615.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论