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

var url1 = 'https://api.wordnik.com/v4/word.json/';
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() {
  noCanvas();
  input = createInput('vinyl');
  submit = createButton('find example');
  submit.mouseClicked(getExample)
  example = createP("hello");
  example.getElementById('sentence');
}

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

function gotData(data) {
  example.html(data.examples[0].text);
}

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.
Thanks

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.