How to convert input field value to other language using javascript/jquery -
i need 1 help. need convert text field or input field values selected language using javascript/jquery. explaining code below.
<div id="google_translate_element"> <div class="form-group"> <label for="usr">name:</label> <input type="text" class="form-control" id="usr"> </div> <div class="form-group"> <label for="comment">comment:</label> <textarea class="form-control" rows="5" id="comment"></textarea> </div> <button type="button" class="btn btn-success" id="conv" onclick="convertootherlanguage()">convert</button> </div> <script src="//translate.google.com/translate_a/element.js?cb=googletranslateelementinit"></script>
my script given below.
function convertootherlanguage(){ var name=document.getelementbyid('usr').value; var comment=document.getelementbyid('comment').value; console.log('value',name,comment); }
here have 2 field , 1 drop down select language. suppose user selected language spanish
, filled 2 fields in spanish
language. when click on convert
button name , comment
field value convert english
spanish , same thing happen while selecting english
. total code here in plunkr.please me.
Comments
Post a Comment