Alternatively you may also want to consider the jQuery
addClass function.
CSS: [syntaxhighlighter brush=css,first-line=1,highlight=0,collapse=false,html-script=false] <style>
.newClass{
color: #ff0000;
}
</style>[/syntaxhighlighter]
HTML: [syntaxhighlighter brush=html,first-line=1,highlight=0,collapse=false,html-script=false] <div id="nav">Testing content here</div><br />
<button onclick="addClass()">Click me</button>[/syntaxhighlighter]
Javascript:[syntaxhighlighter brush=javascript,first-line=1,highlight=0,collapse=false,html-script=false]<script type="text/javascript">
function addClass()
{
$("#nav"
.addClass("newClass"
;
}
</script>[/syntaxhighlighter]
Complete Example Script:[syntaxhighlighter brush=php,first-line=1,highlight=0,collapse=false,html-script=false]<?php
// Testing JQUERY add class function
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."downloads.php";
add_to_head('
<style>
.newClass{
color: #ff0000;
}
</style>
'
;
opentable('Testing CSS Function'
;
echo '
<div id="nav">Testing content here</div><br />
<button onclick="addClass()">Click me</button>
';
closetable();
add_to_footer('<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>'
;
add_to_footer('<script type="text/javascript">
function addClass()
{
$("#nav"
.addClass("newClass"
;
}
</script>'
;
require_once THEMES."templates/footer.php";
?>[/syntaxhighlighter]