Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save nathanchen/3243528 to your computer and use it in GitHub Desktop.

Select an option

Save nathanchen/3243528 to your computer and use it in GitHub Desktop.
jQuery - Change Text color and background color
$(':button').click(function () {
$('p').css('background-color', '#000').css('color', '#fff');
});
@devagopikrishna
Copy link

devagopikrishna commented Jul 24, 2018

sai

@devagopikrishna
Copy link

hello

@VISHNUPRAKASH06
Copy link

its not working

@jasadesign-bdg
Copy link

try :
$('p').attr('style','background-color:#000;color:#fff');

*** it's work for me.

@pragathees10
Copy link

please try this :::: $('p').css('background-color', 'red');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment