0

On page I want user can change background of page, apply background image to page. On save click this changed background should be saved in css class.

Suppose my css class is

#content 
{
    background:green;
}

As shown if I select blue color then blue color should be applied to that page background.

And on save button click css should change to

#content 
{
    background:blue;
}
1
  • Do you need to store the background in user's profile? And provide him the same background when he logs back in? Commented Feb 17, 2014 at 7:36

3 Answers 3

1

You can use css():

$('#saveButtonId').click(function() {
    $('#content').css('background','blue');
})
Sign up to request clarification or add additional context in comments.

Comments

0

Use css() in jquery

   $('#saveButton').click(function() {

        $("#content").css('background','blue');
    })

Comments

0

When it's not dynamically loaded then you can use:

 $("#id").click(function ()
 {
    $('#content').css('background','blue');
 });

If it's dynamically loaded:

$(document).on( "click", "#id", function() {
  $('#content').css('background','blue');
});

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.