jquery - How to add Google translate box (single word/sentence, not whole page) to website? -


how add google translate box (single word/sentence, not whole page) website https://translate.google.com/

i got solution. not exact google providing. please improve answer if have better solution.

<div class="translate">         <form method="post">             <input type="text" name="input_element" id="target" placeholder="type germen word">          </form>         <br>         <div class="inpt-el"></div><br>         <div class="translate_control" lang="de"></div>     </div>      <script>     function googlesectionalelementinit() {       new google.translate.sectionalelement({         sectionalnodeclassname: 'translate',         controlnodeclassname: 'translate_control',         background: '#f4fa58'       }, 'google_sectional_element');     }     </script>     <script src="//translate.google.com/translate_a/element.js?cb=googlesectionalelementinit&ug=section&hl=en"></script>     <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>     <script>     $( "#target" ).keyup(function() {       $('.inpt-el').text($(this).val());     });     </script> 

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -