Click here to Skip to main content
15,742,357 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to change the color of my headers using Jquery. The following is my code, I can not see where my error is. Please can anyone help me??? I just finished a tutorial in udemy, and I am trying to do some extra problems.

<!DOCTYPE html>
<title>Working with Jquery</title>
<script src="//"></script>

<script src="//"></script>

<style type="text/css">
    background-color: blue;


    <h1>kakjdnjkasn kashdask ajkshdask jdhsajkd hasjkd hsajdkhsajdk asd</h1>
<h1 id="flavio">This is a heading</h1>
<p id="myParagraph">kjshdkas dhaksjdh ajks hdasjkdhas jkdh</p>


$('#flavio').css({'background-color': red});

    $("#myParagraph").css({"background-color": "black", "color": "white"});


The reason was because I was missing http: in my links from google libraries
Share this answer
Jafarinejadvazifehkhorani 19-Jun-14 17:22pm    
but I have the same code here , and it's working. anyways good to know that problem is resolved.
the only thing that you need is put red between single quota (')
replace the following with yours

$('#flavio').css({'background-color': 'red'});

that's it
Share this answer
Alexander24 19-Jun-14 17:02pm    
I just changed the line you suggested me, but it did not work either

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900