Adding google font api to select menu

Posted by Vivek Dragon on Stack Overflow See other posts from Stack Overflow or by Vivek Dragon
Published on 2012-12-07T05:01:31Z Indexed on 2012/12/07 5:03 UTC
Read the original article Hit count: 215

Filed under:
|
|
|

I am making a select menu with all the fonts in google fonts API. I have referred this https://developers.google.com/webfonts/docs/developer_api link to learn more about API but till now i was not able to make it.

I am adding this Fiddle which i made for this.

HTML

  <select id="styleFont">
          <option value="0">Myraid Pro</option>
          <option value="1">Sans ref</option>
          <option value="2">Times New Roman</option>
          <option value="3"> Arial</option>
 </select>
 <br>
  <textarea id="custom_text"></textarea> 

CSS

 #custom_text{ resize: none;}?

Script

      $("#styleFont").change(function () {
     var id =$('#styleFont option' + ':selected').text();    
    $("#custom_text").css('font-family',id);
    });?

How can i link those fonts to my select box in the fiddle?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html