getElementById is not a function - styling elements made in p5.js

var url1 = '';
var word = 'vinyl';
var url2 = '/examples?includeDuplicates=false&useCanonical=false&limit=5&api_key=MY_API_KEY';
var input;
var submit;
var example;

function setup() {
  input = createInput('vinyl');
  submit = createButton('find example');
  example = createP("hello");

function getExample() {
  loadJSON(url1 + input.value() + url2, gotData);

function gotData(data) {

I’m trying to style my what i’ve made in the above code with css but when I try to link the element to my css file with example.getElementById(‘sentence’) I get the following error.

Uncaught ReferenceError: getElementById is not defined

Not sure what i’m doing wrong, a search seems to tell me that I need to define ‘example’ before I give it an ID?

Any help would be great.

Your error says it all: example.getElementById() is not a function. And the reference agrees with that.

Perhaps you’re looking for the select() function? Again, the reference is your best friend.