jQuery Suggest Overriding (1 post)

  1. bioshox
    Posted 2 years ago #


    I am using the jQuery Select Plugin intergrated into WordPress to generate an auto suggestion text box.

    I need when a result is clicked in the drop down for it to automatically follow a link rather than place the result back into the textbox, so it autosubmits when you click a result for instance, but I can't figure out what I'm missing/how to override it.

    This is the code;

    Registering it...
    jQuery("#applicant-search-input").suggest(ajaxurl + "?action=search", { delay: 500, minchars: 2});

    Integrating it...

    wp_enqueue_script( 'jobman-admin', JOBMAN_URL . '/js/admin.js', false, JOBMAN_VERSION );

    Using It...

    function search_query(){
        global $wpdb;
        $query = "SELECT * FROM wp_postmeta where meta_value like('".$_GET['q']."%') and meta_key in('data2') GROUP BY post_id";
        $myrows = $wpdb->get_results( $query );
        return $myrows;
    function applicant_search() {
        $myrows = search_query();
        foreach($myrows as $key=>$row){
            echo $row->meta_value."\n";
            echo '<span class="meta_value" style="display: none;">'; echo $row->meta_value.'</span>';

    Displaying it...

    <p class="search-box">
    	<label class="screen-reader-text" for="post-search-input">Search Applicants:</label>
            <form method="get" action="/wp-admin/admin.php">
                <input type="hidden" name="page" value="list-applications" />
                <input type="hidden" name="search" value="1" />
                <input type="search" id="search-input" name="q" value="" />
                <input type="submit" name="" id="search-submit" class="button" value="Search Applicants">

Topic Closed

This topic has been closed to new replies.

About this Topic