Skip to content Skip to sidebar Skip to footer

How To Add Button To A Select2 Dropdown On A Dynamic Table

Good day! I'm doing a Dynamic table which you can add/remove row, and I'm using select2 to search Items on the database via ajax and its working well at the moment, then I want to

Solution 1:

In my case I just added this function

formatNoMatches: function( term ) { 

          $('.select2-input').on('keyup', function(e) {
             if(e.keyCode === 13) 
               {
                $("#modalAdd").modal();          
                $(".select2-input").unbind( "keyup" );
               }
          });

        return "<li class='select2-no-results'>"+"No results found.<button class='btn btn-success pull-right btn-xs' onClick='modal()'>Add New Item</button></li>";
        }

Post a Comment for "How To Add Button To A Select2 Dropdown On A Dynamic Table"