0

Is it possible to cut out the white space from the google translate select when you choose a language. In my example if you choose spanish you will see a lot of extra space but is it possible to shrink the select and remove the extra spacing so that it just is the size of the word maybe with just a little extra spacing on the sides like 2px or so?

Since I am using google translate I am not able to create an id I have to use the values that are given with google translate?

$(document).ready(function() {
 $('.goog-te-combo').change(function(){
    $(".goog-te-combo").html($('.goog-te-combo option:selected').text());
    $(this).width($(".goog-te-combo").width());  
 });
});

http://jsfiddle.net/bobrierton/5c1vbo2s/13/

<div id="google_translate_element"></div>                              

<script type="text/javascript">
            function googleTranslateElementInit() {
                new google.translate.TranslateElement({
                    pageLanguage: 'en', 
                    layout: google.translate.TranslateElement.InlineLayout
                }, 'google_translate_element');
            }
        </script>
<script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit">
</script> 
David Brierton
  • 6,977
  • 12
  • 47
  • 104

1 Answers1

1

You had forgotten to close the ul tag. Here is the updated fiddle

jQuery selectors are pretty neat, take a look at them here

In my case i have used the class selector.

sandeep s
  • 385
  • 2
  • 8