Codeless
  • Support Home
  • Themes
  • Support
  • WordPress Tutorials
    • How to Start a Blog
    • Best Website Builders
    • Best Small Business Hosting
    • Email Marketing Services
    • Cheap WordPress Hosting
  • Video Tutorials

Community Forums

Must click twice to Search

focusfocus on clickSearch
    • 9 years, 1 month ago CaryMillsap
      Participant

      Expired

      I don’t like the way the default search works in the Tower theme. Clicking the magnifying glass expands the new “Search…” row, but it doesn’t put focus there. So, searching requires a click on the magnifying glass and then a second click in the newly opened row before the user can begin typing a search term.

      How can I fix this?

      Thank you.

    • 9 years, 1 month ago Mirela
      Participant

      Hello,

      Please go to file js/main.js and find this function:

      function codelessSearchButton(){
      	"use strict";
      	$('.open_search_button').click(function(){
      		if($('body').hasClass('open_search')){
      			$('body').removeClass('open_search');
      		}else
      			$('body').addClass('open_search');
      	});
      

      edit it to this:

      function codelessSearchButton(){
      	"use strict";
      	$('.open_search_button').click(function(){
      		if($('body').hasClass('open_search')){
      			$('body').removeClass('open_search');
      		}else
      		     {	$('body').addClass('open_search');
      			$('.search_bar input[type="text"]').focus();}
      
      	});

      I have added only this line: $('.search_bar input[type="text"]').focus();
      Save file and refresh.

      Best regards!

      • This reply was modified 9 years, 1 month ago by Mirela. Reason: code edit
    • 9 years, 1 month ago CaryMillsap
      Participant

      Expired

      Thank you!

      Fyi, it’s a little bit misleading to indent the new line with the focus() call on it, unless you put braces around both these lines after the “else”. Without the braces, the new line of code will fire regardless of whether the “if” expression is true or false. Indenting it the way you show here makes it seem like the new line of code is part of the “else” block, when it’s not.

      Thank you again, though; problem solved.

    • 9 years, 1 month ago Mirela
      Participant

      Hello,

      Thank you for your suggestion. I already edited the code.

      Best regards!

    • 8 years, 11 months ago CaryMillsap
      Participant

      Expired

      Do you have any advice about how I can implement this in my child theme? Using the functions.php content shown at https://wordpress.stackexchange.com/questions/163301/versioning-import-of-parent-themes-style-css, my site doesn’t pick up /js/main.js.

    • 8 years, 11 months ago Ruco
      Keymaster

      Hello,

      You can unregister the script and register the new one in your child theme.
      Or you can add the function a t custom js box at theme options and overwrite the search function.

      Best regards!

    • 8 years, 1 month ago CaryMillsap
      Participant

      Expired

      This reply has been marked as private.
    • 8 years, 1 month ago Mirela
      Participant

      Hello,


      @CaryMillsap
      ,
      This is the only edit you need to do. It is tested and it works. Please open up a new ticket and send us your ftp credentials in a private reply.
      Add this topic for reference.

      Adding your credentials in this topic will make them accessible to the topic author too.

      Best regards!

    • 8 years, 1 month ago CaryMillsap
      Participant

      Expired

      This reply has been marked as private.
    • 8 years, 1 month ago Mirela
      Participant

      Hello,

      I opened this link: https://37.60.240.179/~methodr8/# and the search field does have focus as soon as you click on the search icon. See screen recording of it: https://drive.google.com/file/d/0B51Lyn41UgszOW42TWZMZnlCUjA/view
      Did you manage to fix your issue?
      Let us know.

      Best regards!

    • 8 years, 1 month ago CaryMillsap
      Participant

      Expired

      Thank you. I had been unable to get it to work in Chrome. I tried in Safari, and it worked. Noting that your video was Chrome, I tried a hard refresh (Shift-Cmd-R), and voilà, yes, it works in Chrome, too. Thank you for your patience and help.

      Is there any chance you could include this in a future version of Tower? It would help more people than just me…

    • 8 years, 1 month ago Mirela
      Participant

      Hello,

      Yes, sure. I have already notified the developers. Thank you for suggesting.
      If you have other suggestions, please do not hesitate to send them to us. Just open a ticket in this other forum, dedicated for them:
      https://support.codeless.co/?forum=suggest-us-features

      Best regards!

      • This reply was modified 8 years, 1 month ago by Mirela.
Viewing 11 reply threads

You must be logged in to reply to this topic.

Login

Log In
Register

Renew Support

  • Renew Specular Support
  • Renew Tower Support
  • Renew Folie Support
  • Renew Handel Support
  • Renew June Support
  • Renew Picante Support
  • Renew Thype Support
  • Renew Regn Support

Search Forums

Forums

  • Bygge – Construction Theme
  • Converta – Software Theme
  • Folie – The WordPress Website Builder
  • Handel – Responsive Multi-Purpose Business Theme
  • June WooCommerce WordPress Theme
  • Livecast – Podcast Theme
  • Picante – Restaurant & Food WordPress Theme
  • Regn | Agency & Business WordPress Theme
  • Remake – Minimal Portfolio & Agency Theme
  • Specular – Multi-Purpose WordPress Theme
  • Suggest us Features
  • Tower – Business-Driven Multipurpose WP Theme
  • Vibrance – Photography Theme

Site Links

  • Support Policy
  • Specular Support Forum
  • Video Tutorials
  • Knowledge Base
  • Guides and Reviews

Useful Articles

  • Build a Website
  • Web Design & Development
  • Hosting
  • WordPress

Login

Log In
Register Lost Password