Olatunji Azeez
Olatunji Azeez

Reputation: 27

Change font-family using jQuery

I want to change the font-family of a string embedded inside a function of jQuery. I have tried every means without luck. Please help me. Here is the code:

$(function() {
  $(".element").typed({
    strings: ["Web/Graphic Designer"],
    typeSpeed: 70,
    showCursor: false,
  });
});

The font-family: 'HelveticaLTStd-Roman' but I can't change it to my preferred font. All help will be appreciated. Thanks.

Upvotes: 0

Views: 197

Answers (1)

Jis van Overschot
Jis van Overschot

Reputation: 101

You can do something like this. Adding .css() for adding the specific font on your selected elements.

$(function() {
  $(".element").typed({
    strings: ["Web/Graphic Designer"],
    typeSpeed: 70,
    showCursor: false,
  }).css("font-family", "HelveticaLTStd-Roman");
});

Here is jQuery's offical documentation on .css http://api.jquery.com/css/

Don't forget to include the font to your project.

Upvotes: 1

Related Questions