Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

jquery autocomplete search

 $(document).on('keyup', ".floor_name", function(){
                if(!$("#project_id").val()){
                    alert("Select Project Name First");
                }else{
                    let project_id  = $("#project_id").val();
                    $(this).closest('tr').find('.floor_id').val('');
                    $(this).autocomplete({
                        source: function( request, response ) {
                            $.ajax({
                                url:"{{route('scj.floorAutoSuggest')}}",
                                type: 'post',
                                dataType: "json",
                                data: {
                                    _token: CSRF_TOKEN,
                                    search: request.term,
                                    project_id: project_id
                                },
                                success: function( data ) {
                                   
                                    if (data.length > 0) {
                                        response( data );
                                } else {
                                    //If no records found, set the default "No match found" item with value -1.
                                    
                                    response([{ 
                                        label: 'No results found.',
                                        val: -1,
                                        floor_id: null
                                    }]);
                                }
                                },
                                error: function(xhr, status, error) {
                                }
                            });
                        },
                        select: function (event, ui) {
                            if (ui.item.val == -1) {
                                $(this).val("");
                                $(this).closest('tr').find('.floor_id').val(ui.item.floor_id);
                                return false;
                            }
                            $(this).val(ui.item.label);
                                $(this).closest('tr').find('.floor_name').val(ui.item.label);
                                $(this).closest('tr').find('.floor_id').val(ui.item.floor_id);
                        }
                    });
                }
            });
Comment

jquery autocomplete select

$( ".selector" ).autocomplete({
  appendTo: "#someElem"
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: window onfocus 
Javascript :: file_get_contents in javascript 
Javascript :: remove btn 
Javascript :: vuejs copy to clipboard 
Javascript :: how to copy object in javascript 
Javascript :: change profile photo with javascript 
Javascript :: hot to set file views in nodejs 
Javascript :: ejs public 
Javascript :: create a panda component react 
Javascript :: sequelize order by nulls last 
Javascript :: convert div to pdf javascript 
Javascript :: loops javascript 
Javascript :: crud in node 
Javascript :: react svg 
Javascript :: get node by value neo4j 
Javascript :: How to validate an unicode email address in JavaScript 
Javascript :: react-native-charts-wrapper:compileDebugJavaWithJavac FAILED 
Javascript :: duplicate characters in a string javascript 
Javascript :: search filter with react native on flatlist 
Javascript :: instagram unfollow console code 
Javascript :: calculate sum in empty array javascript 
Javascript :: find element in array underscore js 
Javascript :: Get Input arrays 
Javascript :: Getting Search Parameters From A URL As An Array 
Javascript :: postDataToFirebase 
Javascript :: react js class component 
Javascript :: Sequelize plain result 
Javascript :: js create and call function 
Javascript :: react qurery jest test mock queryClientProvider 
Javascript :: json schema bsp 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =