Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8105473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:10:25+00:00 2026-06-06T00:10:25+00:00

I loaded d dynamic list of web fonts offered by the Google Web Fonts

  • 0

I loaded d dynamic list of web fonts offered by the Google Web Fonts service and place it in a select list ,like :

$.get("https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyChZeTZ-DzMW-45IUBXUSuBha9MWEiXXtI", 
     {}, function (data) {
     $.each(data.items, function (index, value) {
        $('#fonts').append($("<option></option>")
                   .attr("value", value.family)
                   .text(value.family);
    });

Now what i want is to load each font when user select it from the select list and for this i tried :

$("#fonts").live({ change: function () { 
    $.get("http://fonts.googleapis.com/css?family=" + $(this).val(), {}, 
    function () { alert("font loaded"); }); } });

but unfortunately this is not working can anybody please help me out?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:10:26+00:00Added an answer on June 6, 2026 at 12:10 am

    The second get request simply returns the needed CSS to load the webfont.

    You should either embed that on the page, or easier add a link tag to the page content that will load the google style.

    Then you will also need to set the font-family wherever it’s used…

    Something like that:

    $("#fonts").live('change', function () { 
    
        $('body').append("<link rel='stylesheet' id='colorbox-css'  href='http://fonts.googleapis.com/css?family=" + escape($(this).val()) +"' type='text/css' media='all' />");
    
        $('body').css({'font-family':'"'+$(this).val()+'"'})
    
    });
    
    
    
    $.get("https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyChZeTZ-DzMW-45IUBXUSuBha9MWEiXXtI",  {}, function (data) {
    
        $.each(data.items, function (index, value) {
                $('#fonts').append($("<option></option>")
                        .attr("value", value.family)
                        .text(value.family));
                        });
    
    
    });
    

    Note: escape is also used to generate the url in case it need to be url-encoded

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dynamic list loaded into a HTML 5 web app built using
Possible Duplicate: Dynamic module import in Python I have a list of modules, like
is it possible to extract dynamic loaded text from a swf (flash application) programatically
I loaded up the .net 3.5 FastMember from http://code.google.com/p/fast-member/source/checkout in VS 2010. The compiler
I want to create ASP.NET 4.0 dynamic pages loaded from my MS SQL server.
I get dynamic content with Ajax and i put it in a div, but
I have an excel sheet that is loaded with a dynamic result set of
I am interesting in Google AdSense bot's algorithm and behavior with web site. I
Trying to build a dynamic gallery that is loaded via AJAX. I'm trying to
I writed a dynamic library that loaded into target application by environment variable DYLD_INSERT_LIBRARIES,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.