gavin stanley
gavin stanley

Reputation: 1102

what is '.js' doing at the beginning of a style in a stylesheet

I am having to edit somebody else's code and they seem to have used a whole load of jQuery for something that would otherwise seem quite simple to me - an html form.

When I switch off some of the jQuery I lose a load of styles and it seems that is because all the styles are pre-fixed with .js eg:

.js .classname{width:50px}

When I take out the .js bit it works, but am I missing something? What is the point in this (seemingly) over-complicated methodology?

Taking out the jquery doesn't change the markup <div class='classname'>. Sorry for lack of code, its somebody elses. I don't know jquery and would rather not use it.

Upvotes: 1

Views: 56

Answers (1)

GolezTrol
GolezTrol

Reputation: 116160

This is a common trick. The js class is added to a main element (usually HTML or sometimes BODY) using Javascript. This allows you to easily make adjustments in CSS that apply when Javascript is active/supported or not. For instance, you can show a 'refresh' button by default and hide it as soon as auto-refresh javascript events are activated.

So there's nothing special about it. Just something your predecessor has added himself/herself.

Upvotes: 6

Related Questions