Javascript jquery: Difference between revisions
From wikinotes
(→Notes) |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 20: | Line 20: | ||
|} | |} | ||
</blockquote><!-- Tutorials --> | </blockquote><!-- Tutorials --> | ||
= Example = | |||
<blockquote> | |||
<syntaxhighlight lang="javascript"> | |||
function hospitalAndAddr() { | |||
var hospital = $(this).children("h3")[0].innerText; | |||
var addr = $(this).children("p")[0].innerText; | |||
return `${hospital}\n${addr}`; | |||
} | |||
var hospitals = $("article.hospitals").map(hospitalAndAddr); | |||
for (const h of hospitals) { | |||
console.log(h); | |||
} | |||
</syntaxhighlight> | |||
</blockquote><!-- Example --> | |||
= Notes = | = Notes = |
Latest revision as of 19:53, 4 February 2023
Abstracts HTML DOM, CSS, events, AJAX.
Documentation
official docs https://api.jquery.com/ home https://jquery.com/
Tutorials
w3schools tut https://www.w3schools.com/jquery/default.asp
Example
function hospitalAndAddr() { var hospital = $(this).children("h3")[0].innerText; var addr = $(this).children("p")[0].innerText; return `${hospital}\n${addr}`; } var hospitals = $("article.hospitals").map(hospitalAndAddr); for (const h of hospitals) { console.log(h); }
Notes
jquery datatypes jquery selectors jquery events jquery elements