Insert google search script into the search bar I did

Asked

Viewed 239 times

1

I use my search bar on my site and I will use the google search system, only I didn’t necessarily want to use the bar that google generates, I wanted to use mine, someone can help me?

(function() {
    var cx = '011166474705386424309:un7tmwwznck';
    var gcse = document.createElement('script');
    gcse.type = 'text/javascript';
    gcse.async = true;
    gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(gcse, s);
})();
<div class="row d-flex justify-content-center">
   <div class="col-md-10">
       <form class="form-wrap mt-4">
           <div class="btn-group" role="group" aria-label="Basic example">
               <input type="text" placeholder="O que você está procurando?" class="btn-group1">
               <input type="text" placeholder="Itajubá" class="btn-group2">
               <button type="submit" class="btn-form"><span class="icon-magnifier search-icon"></span>PESQUISAR<i class="pe-7s-angle-right"></i></button>
           </div>
        </form>

    </div>
</div>
<gcse:search></gcse:search>

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.