Coded component examples
This page contains example code for some general use cases for the Coded component
Getting an element from the DOM
<!--- HTML defined in the HTML Content property -->
<p id="text-content">My Text</p>
<button>Sign Up!</button>// If you have defined a custom namespace on the Coded Component, use that instead
const textParagraph = appfarm.element.querySelector("#text-content") // Get an element by ID
const myButton = appfarm.element.querySelector("button") // Will get the first button in the DOM
// Do things with your paragraph and button...
// ...Setting the value of a paragraph
<!--- HTML defined in the HTML Content property -->
<p id="text-content">My Text</p>Listening to events
Getting data from appfarm
Calling actions
CSS
Importing scripts and stylesheets
Last updated
Was this helpful?
