Html DOM: Difference between revisions

From wikinotes
(Created page with "Query/Manipulate an HTML page from javascript using it's DOM (domain-object-model). = Examples = <blockquote> <syntaxhighlight lang="javascript"> document.querySelector('...")
 
No edit summary
Line 1: Line 1:
Query/Manipulate an HTML page from [[javascript]] using it's DOM (domain-object-model).
Query/Manipulate an HTML page from [[javascript]] using it's DOM (domain-object-model).
= Documentation =
<blockquote>
{| class="wikitable"
|-
| DOM docs || https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model
|-
|}
</blockquote><!-- Documentation -->


= Examples =
= Examples =

Revision as of 19:00, 31 August 2021

Query/Manipulate an HTML page from javascript using it's DOM (domain-object-model).


Documentation

DOM docs https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model


Examples

document.querySelector('div.foo-class');      // find items by CSS-selector
document.getElementById('foo-id');            // find element with ID
document.getElementsByClassName('foo-class'); // find elements with class