Can anybody tell me why my jquery is not working in codepen

Can anybody tell me why my jquery is not working in codepen
0.0 0

#1

I imported jQuery and copied the code exactly as it was in one of the challanges, but for some reason I can’t get it to work. Here is my pen: https://codepen.io/Dalton779/pen/xjjjLV

Thanks for the help!


#2

There should be no script tags in your JS pane. Or in the html pane for that matter. Codepen doesn’t want you to do any of that head stuff - do it in the settings. And there is no need for the body tag.

This is your js:

$(document).ready(function(){
   $(".well").css("background-color", "green")
}); 

and this is your html:

<div class="center">
  <div class="wrapper">
    <div class="thumbnail">
      <img class="image-scale" src="https://res.cloudinary.com/jpress/image/fetch/w_700,f_auto,ar_3:2,c_fill/http://www.shieldsgazette.com/webimage/1.8487408.1491911078!/image/image.jpg" alt="Alan Shearer"> 
    </div>
    <div class="well">    
      <p>
        "When I was a young boy I wanted to play for Newcastle United, I wanted to wear the number nine shirt and I wanted to score goals at St James' Park. I've lived my dream and I realise how lucky I've been to have done that.
        - Alan Shearer
      </p>   
    </div>
    <div class="well">    
      Alan Shearer, CBE, DL (born 13 August 1970) is a retired English footballer. He played as a striker in the top level of English league football for Southampton, Blackburn Rovers, Newcastle United and the England national team. He is Newcastle's and the Premier League's record goalscorer. He was named Football Writers' Association Player of the Year in 1994 and won the PFA Player of the Year award in 1995. In 1996, he was third in the FIFA World Player of the Year awards. In 2004 Shearer was named by Pelé in the FIFA 100 list of the world's greatest living players.
      <p>
        Shearer scored 283 league goals in his career, including a record 260 in the Premier League (of which 58 were penalties) with a record 11 Premier League hat-tricks, and a total of 422 in all competitions including international at all levels. Until his retirement from international football in 2000, he appeared 63 times for his country and scored 30 goals. Shearer had a goals-to-game ratio of 0.667 throughout his career.
      </P>
    Since retiring as a player in 2006, Shearer has worked as a television pundit for the BBC. In 2009, he briefly left his BBC role to become Newcastle United's manager in the last eight games of their 2008–09 season, in an unsuccessful attempt to save them from relegation. Shearer is a Commander of the Order of the British Empire (CBE), a Deputy Lieutenant of Northumberland, a Freeman of Newcastle upon Tyne and an honorary Doctor of Civil Law of Northumbria and Newcastle Universities.

    </p>   
</div>
<div class="well">
  <ul>
    <li>Premier League’s Record Goal Scorer
    <li>Football Writers’ Association Player of the Year 1994
    <li>Professional Football Association Player of the Year Award 1995
    <li>3rd ranked in FIFA World Player of the Year 1996
    <li>11 Premier League Hat-tricks
    <li>Best goal to game ratio of any player(0.667)
    <li>Youngest English Player to score a Hat Trick
    <li>Got his 1st Red Card in 100th appearance for Newcastle   
  </ul>
</div>
</div>

If you would like to know more about Alan Shearer you can go to the following <a href="https://en.wikipedia.org/wiki/Alan_Shearer">page</a>
</div>

#3

There are also some problems with you html - missing closing tags for the lis, etc.


#4

Thanks everything works perfectly now :slight_smile: