Problem with Default search text parameter

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 lenineto 8 years, 5 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #6199
    lenineto
    lenineto
    Participant

    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 8 years, 5 months ago by lenineto lenineto.
    #6208
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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>
    
    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #6217
    lenineto
    lenineto
    Participant

    Hi 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?

    #6218
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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 :)


    #6219
    lenineto
    lenineto
    Participant

    I’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

    #6220
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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 :)


    #6222
    lenineto
    lenineto
    Participant

    Hi 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,

    #6224
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    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 :)


    #6233
    lenineto
    lenineto
    Participant

    You’re the man! Worked like a charm.
    Many thanks for your great support.

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘Problem with Default search text parameter’ is closed to new replies.