Avatar of Jacko_Pinto
Jacko_Pinto
 asked on

Define a class in JS file

Can I add (define) a class inside a JS file?  I don't have access to the CSS file of this particular site so I'm wondering  if I can do it from the java script file to which I do have access.  Complete newbie here, thanks for the comments.
JavaScriptJavaCSS

Avatar of undefined
Last Comment
Kyle Hamilton

8/22/2022 - Mon
SOLUTION
Kyle Hamilton

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Hagay Mandel

I guess that if you can insert javascript to the page, you can add style tags with the desired class(es), not to mention to link to a new CSS file.
Kyle Hamilton

my understanding was you can only edit an existing javascript file, not the document?

(just don't put the script tags inside the js).
Chris Stanyon

If you can edit the javascript file, simply use it to write a new <link> in the head pointing to the url for a stylesheet of your choice :)
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER CERTIFIED SOLUTION
Kyle Hamilton

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.