Link to home
Create AccountLog in
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.
SOLUTION
Avatar of Kyle Hamilton
Kyle Hamilton
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of 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.
my understanding was you can only edit an existing javascript file, not the document?

(just don't put the script tags inside the js).
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 :)
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.