1

したがって、入力から2つの変数を呼び出し、「#key」変数で「split( this.value );」からデータベース内の最後の呼び出しを呼び出す問題がここにあります。このように出力します

//これでいい

touser: カレン・ガランテ、ジョー・モヌチャ、ワッパ・フー、

//これが必要です

rnkey: カレン・ガランテ、ジョー・モヌチャ、gdhdf9j7hd98fg7dfn、

// nappppaa8686f86df8,iuof79f79ds7h8j7kg70gfd70fg8dsf,gdhdf9j7hd98fg7dfn,

私はjquery uiとivが初めてで、このコードに数日間取り組んでいます。

$(function() {
    var availableTags = [
    {
            value: "iuof79f79ds7h8j7kg70gfd70fg8dsf",
            label: "jor monucha",
            desc: "the write less, do more, JavaScript library",
            icon: "16.png"
    },
            {
            value: "nappppaa8686f86df8",
            label: "karen galante",
            desc: "the write less, do more, JavaScript library",
            icon: "16.png"
    },        {
            value: "gdhdf9j7hd98fg7dfn",
            label: "wappa who",
            desc: "the write less, do more, JavaScript library",
            icon: "16.png"
    },
        ];
    function split( val ) {
        return val.split( /,\s*/ );
    }
    function extractLast( term ) {
        return split( term ).pop();
    }

    $( "#tags" )
        // don't navigate away from the field on tab when selecting an item
        .bind( "keydown", function( event ) {
            if ( event.keyCode === $.ui.keyCode.TAB &&
                    $( this ).data( "autocomplete" ).menu.active ) {
                event.preventDefault();
            }
        })
        .autocomplete({
            minLength: 2,
            source: function( request, response ) {
                // delegate back to autocomplete, but extract the last term
                response( $.ui.autocomplete.filter(
                    availableTags, extractLast( request.term ) ) );
            },
            focus: function() {
                // prevent value inserted on focus
                return false;

            },







       select: function( event, ui ) {
            $( "#project" ).val( ui.item.label );
            $( "#project-id" ).val( ui.item.value );
            $( "#project-description" ).html( ui.item.desc );
            $( "#project-icon" ).attr( "src", "images/" + ui.item.icon );


                var hintkey = split( this.value );
                // remove the current input
                hintkey.pop();
                // add the selected item
                hintkey.push( ui.item.value );
                // add placeholder to get the comma-and-space at the end
                hintkey.join( ", " );
                hintkey.push( "" );

                $( "#key" ).val(hintkey);

                var terms = split( this.value );
                // remove the current input
                terms.pop();
                // add the selected item
                terms.push( ui.item.label );
                // add placeholder to get the comma-and-space at the end
                terms.push( "" );
                this.value = terms.join( ", " );
4

0 に答える 0