JavaScript Notes 7
JavaScript Notes 7
What is jQuery?
Go to : -> https://releases.jquery.com/
Copy CDN link minified version.
Add below line before </body>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
crossorigin="anonymous"></script>
<script src='js/JQuery-first.js'></script>
</body>
</div>
<div id="msgid">
</div>
Write below code in .js file -: in our case JQuery-first.js
$(document).ready(function(){
$("#msgid").html("This is Hello World by JQuery");
})
.css file
.headline{
color: #c8e810;
font-size: 300%;
}
FadeIn
// With the element initially hidden, we can show it slowly:
$("#clickme").click(function() {
$("#book").hide().fadeIn("slow", function() {
// Animation complete
console.log('fade in')
});
});
Add below in HTML
<div id="clickme">
Click here
</div>
<img id="book" src="book.png" alt="" width="200" height="250">
Why jQuery?
FINDING ELEMENTS Using jQuery
The ability to update all of the elements in the jQuery selection is known as implicit iteration.
GETTING THE ELEMENT CONTENT
console.log($('ul').html());// display all list html
console.log($('ul').text());// display only the content of lists