Use this in the page footer (after the element to be changed) Change the html content and add an on click submit form to a span
Category: Manipulating HTML
Changing an image
If you need to stop the image beign changed by a later script you can add this:
Changing href of a link
Use this in the page footer (after the element to be changed)
Changing the contents of html elements
Element types? Can be anything, so <div id=”, <span id=”, <p id=”, etc N.B. You need to place the <script> after the HTML element, or call it within say window.onload = function() (the div or whatever tag you’ve used must be before the javascript on the page) In your html To manipulate text within a […]
Display items from clicking link
Display a single item Display multiple items on a page Give your items a class Your link to show the hidden items
Hide a section of the page
Use .style.display = just make sure when you show it you are using ‘flex’ and not ‘inline’ if the element is a flex! Hide it: Show it To hide a section with id=pageheader” Display it again
Targeting specific elements within an ID
Altering the text within a <p> nested below a <div with the assigned ID=”CreateTokenTokenCost”: If you use this on the ID: You will remove the <div> and <p> surrounding the target text, resulting in styling being lost. Instead use querySelector to target the <p> directly: