Bruce
Bruce

Reputation: 11

add a stylesheet to a JS

I want to add my own font style to the following JS script - how do I this?

<script>
    $(function () {
        $('#contact').validate({
            submitHandler: function (form) {
                $(form).ajaxSubmit({
                    url: 'process.php',
                    success: function () {
                        $('#contact').hide();
                        $('#contact-form').append("<p class='thanks'>Thanks! Your request has been sent.</p>")
                    }
                });
            }
        });
    });
</script>

Upvotes: 0

Views: 60

Answers (3)

Tyler McGinnis
Tyler McGinnis

Reputation: 35276

Just add it straight to that tag if you're just trying to change the font of the 'thanks' class.

$('#contact-form').append("<p class='thanks' style='font-family: yourFont'>Thanks! Your request has been sent.</p>")

Upvotes: 1

Tyler.z.yang
Tyler.z.yang

Reputation: 2450

You'd better set the font in class style through css file.In your css file:

.yourFontClass{
    font-family:Arial;
}

your success callback:

 $('#contact-form').append("<p class='thanks yourFontClass'>Thanks! Your request has been sent.</p>")

Hope it's useful for u. : )

Upvotes: 0

paulka
paulka

Reputation: 133

You have to add stylesheet to your head section

<link href="style.css" rel="stylesheet" type="text/css">

In stylesheet

.thanks {
  font-family: Arial;
}

Upvotes: 0

Related Questions