Lets say you have these functions:
$("div#styleswitcher a.green").click(function(){
$("container").css({'background' : 'green'});
)
$("div#styleswitcher a.blue").click(function(){
$("container").css({'background' : 'blue'});
)
$("div#styleswitcher a.red").click(function(){
$("container").css({'background' : 'red'});
)
$("div#styleswitcher a.yellow").click(function(){
$("container").css({'background' : 'yellow'});
)
You can do something like this:
$("#styleswitcher a").click(function ()
{
$("container").css("background-color", this.className);
});
The background color should be the class name ;)
$("div#styleswitcher a.green").click(function(){
$("container").css({'background' : 'green'});
)
$("div#styleswitcher a.blue").click(function(){
$("container").css({'background' : 'blue'});
)
$("div#styleswitcher a.red").click(function(){
$("container").css({'background' : 'red'});
)
$("div#styleswitcher a.yellow").click(function(){
$("container").css({'background' : 'yellow'});
)
You can do something like this:
$("#styleswitcher a").click(function ()
{
$("container").css("background-color", this.className);
});
The background color should be the class name ;)