Is there a way to apply a CSS style within Javascript?
Say I have a CSS style titled “InfoFont” and I want to apply it to the text written from document.write("Information");, how would I do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You would need to wrap the content you are adding dynamically with a tag containing the desired CSS class.
Are you really adding content via
document.writethough?It would be more common to see something like this: