I have a working Python/Django search form that I need to integrate with my JavaScript tagging script on the front end, so my user's search terms are turned into tags.
The problem is my search form works with ?query=Bee but not ?query=[]Bee. I need to remove the brackets so my search form will work again. Can someone help me adapt my JavaScript to prevent [] being passed into the URL?
HTML SEARCH FORM html page
<form name="input" role="search" class="form-search" action="fridge" method="get">
        <div class="row">
            <div class="col-md-6">    
                <div class="example-wrapper">
                    <div class="tags well">
                        <div placeholder="Enter search" data-tags-input-name="query" id="tag"></div>
                    </div>
                </div>
            </div>
             <br>
            <div class="form-group col-md-3">
                  <button type="submit"  id="searchsubmit" class="btn btn-xlarge rounded-pill btn-block shadow-sm">Search</button>
            </div>   
        </div>          
</form>
Javascript html page
    $( document ).ready(function() {
        var t = $( "#tag" ).tagging();
        t[0].addClass( "form-control" );
        // console.log( t[0] );
    });
})( window.jQuery, window, document );
var tagBody = '(?:[^"\'>]|"[^"]*"|\'[^\']*\')*';
var tagOrComment = new RegExp(
    '<(?:'
    // Comment body.
    + '!--(?:(?:-*[^->])*--+|-?)'
    // Special "raw text" elements whose content should be elided.
    + '|script\\b' + tagBody + '>[\\s\\S]*?</script\\s*'
    + '|style\\b' + tagBody + '>[\\s\\S]*?</style\\s*'
    // Regular name
    + '|/?[a-z]'
    + tagBody
    + ')>',
    'gi');
function removeTags(html) {
  var oldHtml;
  do {
    oldHtml = html;
    html = html.replace(tagOrComment, '');
  } while (html !== oldHtml);
  return html.replace(/</g, '<');
}
Link to tagging CDN: https://cdn.rawgit.com/sniperwolf/taggingJS/master/tagging.min.js
