Jquery & others

  • Jquery in Javascript

Javascript is a client-side programming language, initially for the browser, now designed for interactivity.

Jquery is a library (a collection of code stored in a file, as pre-written code), to implement it we can:

//we can use the downloaded .js file library as SRC and then just add the script.js file

<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script src="./script.js"></script>
</head>

Used back when Browsers had differences in using javascript, nowadays web-animations API and css can handle most of Jquery effects.

For the Document Object Model , the browser interpretation of the webpage.

//First we need to load the page for most
$(document).ready(function(){} )

//or
$(fucntion(){

})

//the syntax we can have 
$(selector).action()

//$ to access the jquery
//we QUERY(selct) with the () using CSS selectors
//then .action 

//for example we can select DOM elements variables
let sel = $(“h2”) 
let sel = document.querySelector("h2")

Check this exercise:

Jquery and timer

When working with audio files we can:

And for the .values from the input:

To have the button to stop/restart we added a counter to the existing code:

For the audio and image on Interval, also used .replaceWith(''):

to actually play the audio in Jquery we use:

More Jquery:

We can also change the attribute of HTML elements and double click:

And the hover:

Also you can chain multiple actions with the mouse:

Last updated