Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Problem with Default search text parameter
This topic contains 8 replies, has 2 voices, and was last updated by lenineto 7 years, 11 months ago.
- AuthorPosts
- October 11, 2015 at 5:54 pm #6199
I need to change the behavior of the “Default search text” parameter. When the user clicks on the search box, the search box should be emptied, but it doesnt. The default text stays there until you start typing, and that confuses the users.
How can I change that so the search box is clear when it get focus?
Thanks
-
This topic was modified 7 years, 11 months ago by
lenineto.
October 13, 2015 at 8:50 am #6208Hi!
It’s not a bug, this is the default browser behavior on placeholder text.
Try using this custom script in your site header or footer to remove the placeholder when the input is focused:
<script> jQuery(function($) { $('input.orig').focus(function(e){ if ($(this).attr('placeholder') != "") $(this).attr('placeholder_temp', $(this).attr('placeholder')); $(this).attr('placeholder',""); }).blur(function(){ $(this).attr('placeholder',$(this).attr('placeholder_temp')); }); }); </script>
-
This reply was modified 7 years, 11 months ago by
Ernest Marcinko.
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 13, 2015 at 4:15 pm #6217Hi Ernest,
Thanks for the tip but unfortunately it doesnt work. You can see it here: http://gourmetclubpty.com/
You will see a search bar right below the slider that says “busqueda de restaurantes”. If you click on it, the text stays there.
I think the easiest and most fool prof way would be change the javascript in the plugin itself, wouldn’t it?
October 13, 2015 at 4:23 pm #6218Hi!
Actually this is better, because it’s update proof. Local changes can get overwritten easily with an update process. Moreover the plugin JS is compressed and built after testing. Unfortunately this solution was only tested in few browsers, it might be impossible to clear the placeholder on some versions.
I’m not able to see the website, I’m getting this red screen: https://i.imgur.com/yT7AYio.png
Can you please check it?
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 13, 2015 at 4:39 pm #6219I’m sorry I forgot the site is closed for public visitors.
Do you want a login data to take a look? If so, where should I send it?Thanks
October 13, 2015 at 7:43 pm #6220Hi!
You can edit your initial post in this thread or upload a .txt file with the details. Both methods are safe and visible only to me and you.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 14, 2015 at 2:14 am #6222Hi Ernest, thanks for your reply.
I’ve updated the initial post with the login data for you.Please let me know if you need anything from me.
Cheers,
October 14, 2015 at 8:57 am #6224Hi!
I think I know why. When I copy/pasted the code here, the apostrophes were changed for some reason, so there is a syntax error.
Please correct the code to this: http://pastebin.com/raw.php?i=jC0z47Qt
I have tested it from the console, and it should be working once it’s corrected.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
October 14, 2015 at 4:20 pm #6233You’re the man! Worked like a charm.
Many thanks for your great support. -
This topic was modified 7 years, 11 months ago by
- AuthorPosts
The topic ‘Problem with Default search text parameter’ is closed to new replies.