This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Using css classes in external javascript file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Using css classes in external javascript file?" Watch "Using css classes in external javascript file?" New topic
Author

Using css classes in external javascript file?

Justin Fox
Ranch Hand

Joined: Jan 24, 2006
Posts: 802
How would I use an external .css class in my external .js file?

Thanks,

Justin Fox


You down with OOP? Yeah you know me!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60743
    
  65

Once a JavaScript file is loaded, there is no difference between whether the script was on-page or in an external file. So your script can reference any CSS class just as if it were defined on-page.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
jQuery in Action, 2nd edition
 
subject: Using css classes in external javascript file?
 
Similar Threads
JSF: tomahawk dataTable rowStyleClass problem while applying alternate colors to rows
layout and multibrowser hell
Taglib to attach CSS-File?
JSF - Problems with NetBeans 6.9.1
Activex xmldom nightmare