JavaScript

querySelector()

Në shqip përdoret i njëjti emër.

ShpjegimiSQ

document.querySelector() e gjen elementin e parë në faqe që përputhet me një përzgjedhës CSS — p.sh. "#titulli" ose ".butoni" — që ta lexosh ose ta ndryshosh me JavaScript. querySelectorAll() i gjen të gjithë.

EnglishEN

document.querySelector() finds the first element on the page matching a CSS selector — like "#title" or ".button" — so you can read or change it with JavaScript. querySelectorAll() finds them all.

Si ta mendosh

Si kur mësuesja thotë „Nxënësi me bluzë të kuqe, eja te tabela“: e përshkruan kë kërkon, dhe ai del.

Lexoje në anglisht

Like the teacher saying “The student in the red shirt, come to the board”: she describes who she wants, and they step forward.

Shembull kodijavascript

const titulli = document.querySelector("#titulli");
titulli.textContent = "Mirë se vini!";
document.querySelectorAll(".karta").forEach((k) => k.classList.add("e-re"));

Terma të lidhur