Solved

Change Css Class atribute in code

Posted on 2013-05-25
2
194 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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

807 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