This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

set the focus in the input field

Home Forums Product Support Forums Ajax Search Pro for WordPress Support set the focus in the input field

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #34695
    ea40ea40
    Participant

    Hi,

    I implemented the Searchbox on this page: https://kuechenzentrum-mg.de/test-suche/
    On click the magnifier icon the input field is visible.

    I want to set the focus in the input field after it is visible.

    The solution on this page https://wordpress.org/support/topic/how-to-auto-focus-users-on-search-field-with-no-click/ doesn´t work for me.

    Have you a configuration which can help me or have you another solution ?

    BR Ertan

    #34696
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    Try this variation of the custom code instead:

    add_action("wp_footer", "asp_custom_script_wp_footer");
    function asp_custom_script_wp_footer() {
    	?>
    	<script>
    	jQuery(function($){
    		$('.promagnifier').on('click', function(){
    			var _this = this;
    			setTimeout(function() {
    				if ( $(_this).closest('.asp_w').attr('asp-compact') == 'open' ) {
    					$(_this).closest('.asp_w').find('input.orig').focus();
    				}
    			}, 500);
    		});
    
    	});
    	</script>
    	<?php
    }
    #34699
    ea40ea40
    Participant

    You cannot access this content.

    #34720
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

    #34730
    ea40ea40
    Participant

    You cannot access this content.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘set the focus in the input field’ is closed to new replies.