Intro to jQuery
The purpose of jQuery is to make it much easier to use JavaScript on your website.
jQuery is a lightweight, "write less, do more", JavaScript library.
The purpose of jQuery is to make it much easier to use JavaScript on your website.
Kako dodati jQuery?
Napravi novi folder jQuery
Dodaj mu index.html file s osnovnom strukturom
Dodaj main.js file
Poveži main.js file s index.html
Dodaj ovo u head
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>Što je CDN?
Sintaksa
Basic syntax is: $(selector).action()
- $ znakić koji znači da koristimo jQuery
- Selektor koji ce odabrati elemente
- Akcija koja performa nad selektanim elementom
$("p").hide() // hides all paragraphsdocument.ready()
$(document).ready(function(){
// jQuery methods go here...
});
// ili
$(function(){
// jQuery methods go here...
});This is to prevent any jQuery code from running before the document is finished loading (is ready)
Zadaća
Pročitaj članke
31. Intro to jQuery
By tonkec palonkec
31. Intro to jQuery
- 161