Solved

Change Css Class atribute in code

Posted on 2013-05-25
2
196 Views
Last Modified: 2013-06-15
if you have a class in a style section <style></style>, and this class is going to be assigned to various objects, is there a way to change the class 'before' it gets assigned,
i.e. NOT elementsWithClass.classAtribute='newVal'; //the usual, elements already have class,
but class.classAtribute="newVal";//so now, any new elements assigned the class will already have the newVal atribute.
0
Comment
Question by:Silas2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
Jagadishwor Dulal earned 200 total points
ID: 39197171
When you want to add value? You can do it using jQuery but you will need some condition like clickevent or load or somethings.
<script>
$(document).ready(function(){
$('.classname').css("classAtribute","value");
});
</script>

Open in new window

0
 

Author Comment

by:Silas2
ID: 39210401
Let me just try that...
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question