Javascript 如果我从子位置到相同选项再到子位置和相同搜索选择了相同选项,请提醒我该选项已被选中 [ 转移批次 从子位置: 挑选 接收原理 阿勒马特尼特酒店 接待小儿科 入境处接待处 信用卡 2e术语 至子位置: 挑选 接收原理 阿勒马特尼特酒店 接待小儿科 入境处接待

Javascript 如果我从子位置到相同选项再到子位置和相同搜索选择了相同选项,请提醒我该选项已被选中 [ 转移批次 从子位置: 挑选 接收原理 阿勒马特尼特酒店 接待小儿科 入境处接待处 信用卡 2e术语 至子位置: 挑选 接收原理 阿勒马特尼特酒店 接待小儿科 入境处接待,javascript,jquery,Javascript,Jquery,如果我从子位置到相同选项再到子位置和相同搜索选择了相同选项,请提醒我该选项已被选中 [ 转移批次 从子位置: 挑选 接收原理 阿勒马特尼特酒店 接待小儿科 入境处接待处 信用卡 2e术语 至子位置: 挑选 接收原理 阿勒马特尼特酒店 接待小儿科 入境处接待处 信用卡 2e术语 从…起 到 试剂名称 到期日 量 转移 @include('includes.foot') var国家=新猎犬({ datumTokenizer:Bloodhound.tokenizers.obj.whitespa

如果我从子位置到相同选项再到子位置和相同搜索选择了相同选项,请提醒我该选项已被选中
[
转移批次
从子位置:
挑选
接收原理
阿勒马特尼特酒店
接待小儿科
入境处接待处
信用卡
2e术语
至子位置:
挑选
接收原理
阿勒马特尼特酒店
接待小儿科
入境处接待处
信用卡
2e术语
    从…起 到 试剂名称 到期日 量 转移 @include('includes.foot') var国家=新猎犬({ datumTokenizer:Bloodhound.tokenizers.obj.whitespace('name'), queryTokenizer:猎犬,标记,空白, 限额:10, 预取:{ //url指向包含国家名称数组的json文件,请参阅 // https://github.com/twitter/typeahead.js/blob/gh-pages/data/countries.json url:“”, //json文件包含一个字符串数组,但是 //建议引擎需要JavaScript对象,因此这会转换所有 //那些弦 过滤器:函数(列表){ 控制台日志(列表); 返回$.map(列表、函数(国家/地区){ 返回{name:country}; }); } } }); 国家初始化(); $(“#medicineSearchBar”).typeahead(空{ 名称:'国家', displayKey:'名称', //'ttAdapter'将建议引擎包装在一个适配器中 //与typeahead jQuery插件兼容 资料来源:countries.ttAdapter() }); jQuery(“#medicineSearchBar”).on('typeahead:selected',函数(e,datum) { //$('#extraControls').css('display','block'); //console.log('kl'); $(“#results_body”)。追加('+$('''from#u location option:selected')。text()+'
    '+$(''from#u sub#u location option:selected')。text()+'+$('
    '+$(''to#sub u location option:selected')。text()+'+datum\['name'+'19-05-2018'); //console.log($('#shipping_选择器选项:selected').text(); }); 这是data2.json \[“Genouillère renforcée($30)”,“Genouillère Small($20)”,“Genouillères XXL($20)”,“长型护膝($50)”,“Nexcare急救冷藏包($25)”,“Orthèse de Stabilization($55)”,“矫形背部长休息($125)”,“Paire Semelle矫形手术($280)”,“Prothè固定($90)”,“Sac de sable de 500g($25)”,“Slip矫形手术”($70)"\] 如果我从“子位置”到“子位置”选择了相同的选项,则提醒我该选项已被选中;如果以前选择过,则提醒我该选项已被选中 例如:如果我从子位置选择接收原则,从子位置选择接收原则,从子位置选择接收原则,从子位置选择接收原则,从子位置选择接收原则,从子位置选择接收原则,从子位置选择接收原则,然后我再次搜索Genouillère renforcée($30)然后它会提醒我它已经被选中了。 第二次,当我选择SelectReception principale from from Sub location和Reception principale from To Sub location并搜索Genouillère Small($20)时,它应该在表中追加所有值。 如果可以,那么它应该附加到表中。现在看不到数量 有效期及届满日期 这应适用于所有相关下拉选项和搜索列表。][1] 这是我包含的文件的图像 最
                [<div class="container" style="padding-top:70px;">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h4>Transfer Batch</h4>
                        </div>
                        <div class="panel-body">
                            <div class="form-group">
                                <label for="title"></label>
                            </div>
                           <div class="col-md-6" style="margin-top: 20px;">
                                <label for="title">From Sub-location:</label>
                                <select id="from_sub_location"   class="form-control" style="width:350px">
                                    <option value="0">SELECT</option>
                                    <option value="1">Reception principale</option>
                                    <option value="2">Reception Alle Maternite</option>
                                    <option value="3">Reception Alle Pediatriqui</option>
                                    <option value="4">Reception immigration</option>
                                    <option value="5">Carte de credit</option>
                                    <option value="6">2e etage</option>
                                </select>
                            </div>
                            <div class="col-md-6" style="margin-top: 20px;">
                                <label for="title">To sub-location:</label>
                                <select id="to_sub_location"  class="form-control" style="width:350px">
                                    <option value="0">SELECT</option>
                                    <option value="1">Reception principale</option>
                                    <option value="2">Reception Alle Maternite</option>
                                    <option value="3">Reception Alle Pediatriqui</option>
                                    <option value="4">Reception immigration</option>
                                    <option value="5">Carte de credit</option>
                                    <option value="6">2e etage</option>
                                </select>
                            </div>
                            <div class="col-md-3"></div>
                        </div>
                    </div>
                </div>
                <div class="container">
                    <div class="card">
                        <div class="col-md-12" style="padding-top: 10px;padding-bottom: 10px;">
                            <div class="form-group">
                                <input type="text" id="medicineSearchBar" class="form-control" placeholder="Search..." >
                            </div>
                            <ul class="list-group" id="result"></ul>
                            <ul style="width:100%; max-height:300px; overflow-y: scroll;" id="li-psearch" class="dropdown-menu" role="menu"
                                aria-labelledby="menu1">
                                <li role="presentation" class="divider-search"></li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="container">
                    <div class="card">
                <table id="myclass" class="table table-bordered">
    
                                <tr id="mainTable">
                                    <th scope="col">From</th>
                                    <th scope="col">To</th>
                                    <th scope="col">Reagent Name</th>
                                    <th scope="col">Expiry Date</th>
                                    <th scope="col">Quantity</th>
                                </tr>
    
                                <tbody id="results_body">
    
    
                                </tbody>
                            </table>
                        <button type="button" class="btn btn-primary" style="float: right;margin: 4px 2px;">Transfer</button>
                        </div>
                    </div>
                </div>
                </div>
                @include('includes.foot')
                <meta name="loc" content="{{Session::get('loc')}}"/>
    
                <script>
                    var countries = new Bloodhound({
                        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('name'),
                        queryTokenizer: Bloodhound.tokenizers.whitespace,
                        limit: 10,
                        prefetch: {
                            // url points to a json file that contains an array of country names, see
                            // https://github.com/twitter/typeahead.js/blob/gh-pages/data/countries.json
                            url: "<?=asset('assets/img/data2.json');?>",
                            // the json file contains an array of strings, but the Bloodhound
                            // suggestion engine expects JavaScript objects so this converts all of
                            // those strings
                            filter: function (list) {
                                console.log(list);
                                return $.map(list, function (country) {
                                    return {name: country};
                                });
                            }
                        }
                    });
                    countries.initialize();
                    $('#medicineSearchBar').typeahead(null, {
                        name: 'countries',
                        displayKey: 'name',
                        // `ttAdapter` wraps the suggestion engine in an adapter that
                        // is compatible with the typeahead jQuery plugin
                        source: countries.ttAdapter()
                    });
                    jQuery('#medicineSearchBar').on('typeahead:selected', function (e, datum)
                    {
                        //$('#extraControls').css('display','block');
    
                       //console.log('kl');
                        $('#results_body').append('<tr> <td scope="row">'+$('#from_location option:selected').text()+' <br>'+$('#from_sub_location option:selected').text()+'   <\/td><td scope="row">  '+$('#to_location option:selected').text()+' <br> '+$('#to_sub_location option:selected').text()+'  <\/td><td>'+datum\['name'\]+'<\/td><td>19-05-2018<\/td><td><input type="text" class="form-control" id="qty"></td><\/td></tr>');
    
                        //console.log($('#shipping_selector option:selected').text());
    
                    });
                </script>
            This is data2.json 
            \["Genouillère renforcée ($30)","Genouillère Small ($20)","Genouillères XXL ($20)","Knee brace long type ($50)","Nexcare First aid Cold pack ($25)","Orthèse de stabilisation ($55)","Orthopaedic back rest long ($125)","Paire Semelle orthopodéque ($280)","Prothèse pour immobilisation ($90)","Sac de sable de 500g ($25)","Slip orthopédique ($70)"\]
    
            Alert me that it is already selected if i select the same option From sub-location to same option  To-sub-location and same search if it was selected before 
            eg : if i select Reception principale from From Sub-location and Reception principale from To Sub-Location and i reagent search Genouillère renforcée ($30) first time and then i again if i select Reception principale from From Sub-location and Reception principale from To Sub-Location and i reagent  search Genouillère renforcée ($30) then it should alert me that it is already selected.
            The second time when i select   select Reception principale from From Sub-location and Reception principale from To Sub-Location and i reagent search Genouillère Small ($20) then it should append all the value in the table.
    If it is OK then it should append to the table . Now don't see Quantity 
    and expiry Date
    
        This should apply for all dependent dropdown option and search list .][1] 
        This is the image of the file i have included
        Most of the script in this is jQuery.
    
           [1]: https://i.stack.imgur.com/7DDvT.jpg
        if want any file i will provide