-4

Problem Statement:Create a web page with a paragraph, which has a link at the end. If you click on the link, it slowly fades into(about 1.5 sec a #FF0000 (red)block over the text and with a #FFFF00 (yellow)text on the top.

My written HTML code is below:

 <!DOCTYPE html>
 <html>
 <head>
 <title>jquery</title>
 <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
 <script>
 $(document).ready(function(){
 $("[href]").click(function(){
 $("p").hide();
 $("#div1").fadeIn("slow","swing");
 $("#div1").fadeIn(15000,"swing");
 $("div").text("WELCOME GUYS!")
  });
  });
 </script>
 <style>
 p{
 width: 400px;
 height:  90px;
  }
 div{
 width: 550px;
 height: 65px;
 text-align: center;
 font-size: 36px;
 color: #FFFF00;
  }
 #div1{
 width:400px;height:90px;display:none;background-color:#FF0000
 }
 </style>
 </head>
 <body>
 <p>
  Machine learning is a type of artificial intelligence (AI) that provides 
  computers with the ability to learn without being explicitly programmed. 
  <a href="#">click!</a> </p>
  <div id="div1"></div>
  </body>
  </html>

My error which i have to rectify:- Should have got an 'p' component false What should i try now??

1 Answers1

0

Works fine for me. No errors whatsoever in the log. Fades In the div1 . The only problem I see is that You have 2 separate fadeIn functions right after eachother and only the first one is being used.

Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252
Mateusz Mysiak
  • 548
  • 6
  • 19
  • testWeb(jquerypackage.JQAssignment1Fade): Should have got an 'p' component false – Shivam Rastogi Jun 18 '17 at 04:03
  • Here's a working codepen. https://codepen.io/mmsmsy/pen/wegYmy It was working just fine for me, but for the example I've updated the indenting, because it wasn't clear for me. I've also commented out the first fadeIn effect and "swing" parameters, so that the one with 15000 milliseconds would work. The last thing I've changed is the jQuery CDN to the newest version. Just copy the code from codepen and it should be working perfectly. If it's not then it must be something on Your computer I'm afraid. – Mateusz Mysiak Jun 18 '17 at 09:02
  • Thank you so much but I think there is a problem on the company's website only. – Shivam Rastogi Jun 18 '17 at 14:54