Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Problem with Default search text parameter
- This topic has 8 replies, 2 voices, and was last updated 10 years, 7 months ago by
lenineto.
-
AuthorPosts
-
October 11, 2015 at 5:54 pm #6199
lenineto
ParticipantI 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 10 years, 7 months ago by
lenineto.
October 13, 2015 at 8:50 am #6208Ernest Marcinko
KeymasterHi!
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:
[code]
<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>
[/code]-
This reply was modified 10 years, 7 months ago by
Ernest Marcinko.
October 13, 2015 at 4:15 pm #6217lenineto
ParticipantHi 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 #6218Ernest Marcinko
KeymasterHi!
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: http://i.imgur.com/yT7AYio.png
Can you please check it?
October 13, 2015 at 4:39 pm #6219lenineto
ParticipantI’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 #6220Ernest Marcinko
KeymasterHi!
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.
October 14, 2015 at 2:14 am #6222lenineto
ParticipantHi 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 #6224Ernest Marcinko
KeymasterHi!
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.
October 14, 2015 at 4:20 pm #6233lenineto
ParticipantYou’re the man! Worked like a charm.
Many thanks for your great support. -
This topic was modified 10 years, 7 months ago by
-
AuthorPosts
- The topic ‘Problem with Default search text parameter’ is closed to new replies.